結果
| 問題 | No.167 N^M mod 10 |
| コンテスト | |
| ユーザー |
sujinbemani_79c
|
| 提出日時 | 2015-03-20 00:39:20 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 433 bytes |
| コンパイル時間 | 828 ms |
| コンパイル使用メモリ | 68,532 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 23:36:05 |
| 合計ジャッジ時間 | 1,403 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 26 WA * 1 |
ソースコード
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
string N,M;
cin>>N>>M;
long long int NN,MM,ans=1;
NN=N[N.size()-1]-'0';
if(M.size()==1)MM=M[0]-'0';
else MM=((M[M.size()-2]-'0')*10)+(M[M.size()-1]-'0');
for(int i=0;i<MM;i++)ans=ans*NN%10;
if(3<=M.size()&&MM==0)printf("%lld\n",NN);
else printf("%lld\n",ans);
return 0;
}
sujinbemani_79c