結果
問題 | No.487 2017 Calculation(2017の計算) |
ユーザー |
|
提出日時 | 2020-04-12 01:16:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 483 bytes |
コンパイル時間 | 1,571 ms |
コンパイル使用メモリ | 168,108 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-19 19:33:04 |
合計ジャッジ時間 | 2,120 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i, n) for (int i = 0; i < (int)(n); i++)#define llong long longint getval(int times, int divisor) {if(divisor==1) return 0;if(times==0) return 1;if(times==1) return 2017 % divisor;int val = getval(times/2, divisor) % divisor;return val * val % divisor * getval(times%2, divisor);}int main() {int m;cin >> m;int result = (2017 + getval(4034, m)) % m;cout << result << "\n";}