結果

問題 No.167 N^M mod 10
ユーザー suppy193suppy193
提出日時 2017-02-02 15:54:52
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 438 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 25,336 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 18:05:52
合計ジャッジ時間 1,929 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,380 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 0 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 0 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,384 KB
testcase_21 AC 0 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <math.h>

int main(void) {
	int i, j;
	char n[10001], m[10001];
	int n2, m2;
	scanf("%s", n);
	scanf("%s", m);
	
	m2 = n[0] - '0';
	i = 1;
	while(m[i] != '\0'){
		m2 = m2 * 10 + m[i] - '0';
		m2 %= 4;
		i++;
	}
	//printf("%d\n", m2);
	j = 0;
	while(n[j] != '\0'){
		j++;
	}
	n2 = n[j - 1] - '0';
	
	//printf("%d^%d = %d\n", n2, m2, (int)pow(n2, m2) % 10);
	printf("%d\n", (int)pow(n2, m2) % 10);
	
	return 0;
}
0