結果
| 問題 |
No.167 N^M mod 10
|
| コンテスト | |
| ユーザー |
machy
|
| 提出日時 | 2015-06-13 13:20:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 522 bytes |
| コンパイル時間 | 597 ms |
| コンパイル使用メモリ | 75,180 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 16:06:07 |
| 合計ジャッジ時間 | 1,399 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 WA * 4 |
ソースコード
#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;
for(int i = 0; i < M; i++){
ans = ans*N % 10;
}
cout << ans << endl;
return 0;
}
machy