結果
| 問題 |
No.487 2017 Calculation(2017の計算)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-24 23:15:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 477 bytes |
| コンパイル時間 | 528 ms |
| コンパイル使用メモリ | 56,188 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-02 23:51:23 |
| 合計ジャッジ時間 | 1,284 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:11: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%lld",&M);
| ~~~~~^~~~~~~~~~~
ソースコード
#include<iostream>
using namespace std;
#include<cstdio>
#include<cstring>
#include<string>
typedef long long ll;
ll a,b,ans,M,temp;
int main(){
scanf("%lld",&M);
a=2017%M;
for(int i=0;i<2017;i++){
if(i==0){
temp=(a*a)%M;
// printf("%d,%d,&\n", );
}else if(i==1){
b=(temp*temp)%M;
}else{
b=(b*temp)%M;
}
}
ans=(a+b)%M;
printf("%lld\n",ans );
return 0;
}