結果

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

ソースコード

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;
	reverse(N.begin(),N.end());
	reverse(M.begin(),M.end());
	vector<int> latte;
	if ((M[1]-'0')*10+(M[0]-'0')==0){
		printf("%d\n",1); return 0;
	}
	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