結果
問題 |
No.167 N^M mod 10
|
ユーザー |
|
提出日時 | 2015-05-25 19:03:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 300 bytes |
コンパイル時間 | 1,278 ms |
コンパイル使用メモリ | 159,720 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 08:25:51 |
合計ジャッジ時間 | 1,780 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 WA * 8 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ string a,b; cin>>a>>b; if (b == "0") { cout << 1 << endl; return 0; } int x = a[a.length() -1] - '0'; int y = b[b.length() -1] - '0'; y += 10 * (b[b.length() -2] - '0'); int s = 1; for(int i=0;i<y;i++){ s *= x; s %= 10; } cout << s << endl; }