Created
April 18, 2020 03:24
-
-
Save niklasjang/4cccddf19bb75caaa0e9ea57cf330f6a to your computer and use it in GitHub Desktop.
[PS][정수론]/[BOJ][17466][n! mod p]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int n, p; | |
| long long ans = 1; | |
| int main(void) { | |
| cin.tie(NULL); | |
| ios::sync_with_stdio("false"); | |
| cin >> n >> p; | |
| for (int i = 1; i <= n; i++) { | |
| ans *= i; | |
| ans %= p; | |
| } | |
| cout << ans << "\n"; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment