結果
問題 |
No.167 N^M mod 10
|
ユーザー |
![]() |
提出日時 | 2015-03-20 00:05:53 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 379 bytes |
コンパイル時間 | 432 ms |
コンパイル使用メモリ | 69,164 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-28 23:29:43 |
合計ジャッジ時間 | 1,147 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 WA * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:15:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=] 15 | printf("%d\n",ans); | ~^ ~~~ | | | | int long long int | %lld
ソースコード
#include<cstdio> #include<cmath> #include<iostream> #include<algorithm> #include<queue> using namespace std; int main(){ string N,M; cin>>N>>M; long long int NN,MM,ans=1; NN=N[N.size()-1]-'0'; if(M.size()==1)MM=M[0]-'0'; else MM=((M[M.size()-2]-'0')*10)+(M[M.size()-1]-'0'); for(int i=0;i<MM;i++)ans=ans*NN%10; printf("%d\n",ans); return 0; }