結果

問題 No.487 2017 Calculation(2017の計算)
ユーザー bttb0209
提出日時 2017-02-28 21:30:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 69,856 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-12 00:32:38
合計ジャッジ時間 1,347 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>

#define MAX(a,b) ((a)>(b) ? (a) : (b))
#define MIN(a,b) ((a)<(b) ? (a) : (b))
#define ABS(a) ((a)>0 ? (a) : (a * -1))

using namespace std;
int main(){
	long long n, buf1, ans;
	cin >> n;

	ans = buf1 = (2017 * 2017) % n;
	for (int i = 1; i < 2017; i++) {
		ans = (ans * buf1) % n;
	}
	ans = (ans + 2017) % n;
	cout << ans << endl;
}
0