結果
問題 | No.167 N^M mod 10 |
ユーザー |
![]() |
提出日時 | 2015-06-13 13:25:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 575 bytes |
コンパイル時間 | 491 ms |
コンパイル使用メモリ | 74,972 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-06 16:06:15 |
合計ジャッジ時間 | 1,246 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 WA * 3 |
ソースコード
#include <iostream>#include <algorithm>#include <vector>#include <string>#include <cmath>#include <iomanip>#include <map>using namespace std;typedef long long LL;int main(){string ns, ms;cin >> ns >> ms;LL N = ns[ns.size()-1] - '0';LL M = ms[ms.size()-1] - '0';if(ms.size() >= 2) M += 10 * (ms[ms.size()-2]-'0');LL ans = 1;if(N == 0 && (ms.size() > 1 || M != 0)) ans = 0;if(N == 8 && (ms.size() > 1 || M != 0)) ans = 6;for(int i = 0; i < M; i++){ans = ans*N % 10;}cout << ans << endl;return 0;}