結果

問題 No.167 N^M mod 10
ユーザー Vir_MeL0Vir_MeL0
提出日時 2017-03-22 23:32:47
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 535 bytes
コンパイル時間 3,343 ms
コンパイル使用メモリ 71,508 KB
実行使用メモリ 51,600 KB
最終ジャッジ日時 2023-09-19 05:29:35
合計ジャッジ時間 6,196 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
49,140 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 47 ms
49,136 KB
testcase_06 AC 44 ms
49,308 KB
testcase_07 AC 44 ms
49,220 KB
testcase_08 AC 45 ms
49,432 KB
testcase_09 AC 45 ms
49,204 KB
testcase_10 AC 44 ms
49,204 KB
testcase_11 AC 44 ms
49,064 KB
testcase_12 AC 44 ms
49,260 KB
testcase_13 AC 44 ms
49,580 KB
testcase_14 AC 44 ms
49,048 KB
testcase_15 AC 44 ms
49,252 KB
testcase_16 AC 44 ms
49,596 KB
testcase_17 AC 44 ms
49,284 KB
testcase_18 AC 68 ms
49,852 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int N = Integer.parseInt(str);
		str = br.readLine();
		int M = Integer.parseInt(str);
		if (M == 0)
			System.out.println("1");
		else {
			int ans = N % 10;
			for (int i = 1; i < M; i++)
				ans = (ans * N) % 10;
			System.out.println(ans);
		}
	}
}
0