Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

모듈러 연산 #34

Open
WonYong-Jang opened this issue May 1, 2020 · 0 comments
Open

모듈러 연산 #34

WonYong-Jang opened this issue May 1, 2020 · 0 comments

Comments

@WonYong-Jang
Copy link
Owner

WonYong-Jang commented May 1, 2020

모듈러 연산

몇 가지 중요한 암호 시스템은 계산 결과가 항상 0 - (m-1) 범위에있는 경우 모듈러 연산을 사용한다.

이때 m은 %를 하고자 하는 modular 값이다.
우리가 익히 알고있는 모듈러 연산을 해보자.
17 mod 5 = 2
7 mod 11 = 7
20 mod 3 = 2
11 mod 11 = 0

음수의 경우에도 모듈러 연산이 가능하다.

-3 mod 11 = 8
-1 mod 11 = 10
25 mod 5 = 0
-11 mod 11 = 0

음수를 mod 할 경우에는 양수라 생각하고 mod를 한 후 + m을 해주면 된다.

예를 들어 -20 mod 11이면 20 mod 11 = 9 에서 -9 + 11 = 2와 같다.

출처: https://www.crocus.co.kr/1231 [Crocus]

관련 문제

  1. Subarray Sums Divisible by K
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant