結果
| 問題 |
No.167 N^M mod 10
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-15 18:25:58 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 476 bytes |
| コンパイル時間 | 2,646 ms |
| コンパイル使用メモリ | 192,928 KB |
| 最終ジャッジ日時 | 2025-01-15 07:35:06 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 WA * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
string s,t; cin >> s >> t;
if(t=="0")printf("0\n");
else{
int p=s.back()-'0';
int q;
if(t.size()==1)q=t.back()-'0';
else q=(t[t.size()-2]-'0')*10+t.back()-'0';
q%=4;
int res=1;
for(int i=0;i<q;i++){
res*=p;
}
cout << res%10 << endl;
}
}