結果
| 問題 | No.487 2017 Calculation(2017の計算) |
| コンテスト | |
| ユーザー |
tatuyan_edson
|
| 提出日時 | 2017-02-24 09:17:43 |
| 言語 | C11(gcc12 gnu拡張) (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 305 bytes |
| 記録 | |
| コンパイル時間 | 103 ms |
| コンパイル使用メモリ | 31,604 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-08 16:09:08 |
| 合計ジャッジ時間 | 876 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d",&M);
| ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main(void){
int M,tmp,ans,i;
scanf("%d",&M);
//2017=1024+512+256+128+64+32 +1
tmp=2017*2017%M;
ans=2017*2017%M;
for(i=0;i<11;i++){
if(i>=5){
ans*=tmp;
ans%=M;
}
tmp*=tmp;
tmp%=M;
}
ans+=2017;
ans%=M;
printf("%d\n",ans);
return 0;
}
tatuyan_edson