結果

問題 No.167 N^M mod 10
ユーザー wing3196
提出日時 2015-03-20 00:54:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 528 bytes
コンパイル時間 592 ms
コンパイル使用メモリ 82,052 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-28 23:37:04
合計ジャッジ時間 1,421 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>
#include<climits>
#include<functional>
#include<map>
#include<set>
#include<queue>
#include<cmath>
using namespace std;

signed main(){
	string N,M;
	cin>>N>>M;
	if(atoi(&M[0])==0){
		puts("1"); return 0;
	}
	reverse(N.begin(),N.end());
	reverse(M.begin(),M.end());
	vector<int> latte;
	int calc = 1, cnt = (M[1]-'0')*10+(M[0]-'0')+4;
	for(int i=0;i<cnt;i++) calc = calc*(N[0]-'0')%10;
	printf("%d\n",calc);
	return 0;
}
0