結果
| 問題 |
No.167 N^M mod 10
|
| コンテスト | |
| ユーザー |
dnish
|
| 提出日時 | 2017-07-04 22:34:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 374 bytes |
| コンパイル時間 | 1,538 ms |
| コンパイル使用メモリ | 166,640 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-05 16:18:20 |
| 合計ジャッジ時間 | 2,414 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 14 WA * 13 |
ソースコード
#include <bits/stdc++.h>
#define p(s) cout<<(s)<<endl
typedef long long ll;
using namespace std;
const int inf=1e9;
ll fast_power(ll a, ll b, ll m){
ll ret=1;
while(b>0){
if(b & 1){
ret*=a;
}
a*=a;
a%=m;
ret%=m;
b >>= 1;
}
return ret;
}
int main(){
string s1,s2;
cin>>s1>>s2;
ll ans=fast_power(s1.back()-'0',s2.back()-'0',10);
p(ans%10);
return 0;
}
dnish