結果

問題 No.167 N^M mod 10
ユーザー SSRS
提出日時 2020-11-10 12:33:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 298 bytes
コンパイル時間 959 ms
コンパイル使用メモリ 67,364 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-22 17:25:17
合計ジャッジ時間 1,753 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;
int main(){
	string N;
	cin >> N;
	string M;
	cin >> M;
	M = "0" + M;
	int a = stoi(N.substr(N.size() - 1));
	int b = stoi(M.substr(M.size() - 2)) % 4;
	int ans = 1;
	for (int i = 0; i < b; i++){
		ans *= a;
	}
	cout << ans % 10 << endl;
}
0