結果
| 問題 |
No.487 2017 Calculation(2017の計算)
|
| コンテスト | |
| ユーザー |
Yut176
|
| 提出日時 | 2017-02-24 22:30:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 628 bytes |
| コンパイル時間 | 788 ms |
| コンパイル使用メモリ | 83,948 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-01-02 22:57:27 |
| 合計ジャッジ時間 | 1,532 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
ソースコード
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
using namespace std;
// 累乗 a^b mod p を返す
long long int powmod(long long int a, long long int b, long long int p){
if( b == 0 ) return 1;
if( b%2 == 0 ){
long long int d = powmod(a, b/2, p);
return ((d%p) * (d%p)) % p;
}
return ( (a%p) * (powmod(a, b-1, p)%p) ) % p;
}
int main(){
long long int m;
cin >> m;
long long int x = 2017 + powmod(2017 * 2017, 2017, m);
cout << x % m << endl;
return 0;
}
Yut176