結果

問題 No.167 N^M mod 10
ユーザー 沙耶花
提出日時 2021-11-03 12:31:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 418 bytes
コンパイル時間 2,169 ms
コンパイル使用メモリ 192,088 KB
最終ジャッジ日時 2025-01-25 10:52:49
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 5000000000000000000



int main(){	
	
	string s,t;
	cin>>s>>t;
	
	int N = 0,M = 0;
	rep(i,s.size()){
		N *= 10;
		N += s[i]-'0';
		N %= 10;
	}
	rep(i,t.size()){
		M *= 10;
		M += s[i]-'0';
		M %= 2520;
	}
	
	int ans = 1;
	rep(i,M){
		ans *= N;
		ans %= 10;
	}
	cout<<ans<<endl;
	
	return 0;
	
}
0