結果

問題 No.167 N^M mod 10
ユーザー data9824
提出日時 2015-05-24 20:46:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 355 bytes
コンパイル時間 474 ms
コンパイル使用メモリ 59,988 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-06 08:06:18
合計ジャッジ時間 1,509 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main() {
	string n, m;
	cin >> n >> m;
	static int lsd[10][10]; // [n][m]
	for (int n = 0; n < 10; ++n) {
		lsd[n][0] = 1;
		for (int m = 1; m < 10; ++m) {
			lsd[n][m] = lsd[n][m - 1] * n % 10;
		}
	}
	cout << lsd[(n.back() - '0')][(m.back() - '0')] << endl;
	return 0;
}
0