結果
問題 |
No.167 N^M mod 10
|
ユーザー |
![]() |
提出日時 | 2018-03-14 08:53:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 332 bytes |
コンパイル時間 | 1,133 ms |
コンパイル使用メモリ | 55,388 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-25 23:59:34 |
合計ジャッジ時間 | 1,637 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 WA * 10 |
ソースコード
#include<iostream> #include<string> using namespace std; int main(){ string N,M; int n,m,ans; cin >> N >> M; n = (int)N[N.length()-1]-48; m = (int)M[M.length()-1]-48; if(M == "1") ans = n; else{ ans = n; for(int i=1;i<m;i++) ans = ans*n%10; } cout << ans << endl; return 0; }