結果
問題 | No.487 2017 Calculation(2017の計算) |
ユーザー |
![]() |
提出日時 | 2017-03-04 01:17:48 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 352 bytes |
コンパイル時間 | 666 ms |
コンパイル使用メモリ | 56,084 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 05:57:19 |
合計ジャッジ時間 | 900 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 |
ソースコード
#include <iostream> typedef long long LL; static LL modpow(LL b, LL e, LL m) { LL r = 1; while (e > 0) { if (e & 1) { r = (r * b) % m; } e >>= 1; b = (b * b) % m; } return r; } int main(int argc, char *argv[]) { int M; std::cin >> M; LL ans = (2017 + modpow(2017 * 2017, 2017, M)) % M; std::cout << ans << std::endl; return 0; }