結果

問題 No.167 N^M mod 10
ユーザー kenkooookenkoooo
提出日時 2015-03-19 23:35:56
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 432 bytes
コンパイル時間 2,032 ms
コンパイル使用メモリ 74,348 KB
実行使用メモリ 54,912 KB
最終ジャッジ日時 2024-06-28 23:21:03
合計ジャッジ時間 6,193 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 140 ms
53,956 KB
testcase_03 AC 138 ms
53,808 KB
testcase_04 WA -
testcase_05 AC 109 ms
54,112 KB
testcase_06 WA -
testcase_07 RE -
testcase_08 AC 113 ms
53,916 KB
testcase_09 AC 114 ms
54,424 KB
testcase_10 RE -
testcase_11 AC 110 ms
52,844 KB
testcase_12 RE -
testcase_13 WA -
testcase_14 RE -
testcase_15 AC 92 ms
53,260 KB
testcase_16 AC 91 ms
52,600 KB
testcase_17 AC 106 ms
54,000 KB
testcase_18 AC 105 ms
53,996 KB
testcase_19 AC 97 ms
53,252 KB
testcase_20 AC 108 ms
54,100 KB
testcase_21 AC 115 ms
54,228 KB
testcase_22 AC 141 ms
53,904 KB
testcase_23 AC 134 ms
54,408 KB
testcase_24 AC 161 ms
54,408 KB
testcase_25 AC 127 ms
54,072 KB
testcase_26 RE -
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String nString = sc.next();
		String mString = sc.next();
		sc.close();
		int a = Character.getNumericValue(nString.charAt(nString.length() - 1));
		int b = Integer.parseInt(mString.substring(mString.length() - 2, mString.length()));
		b %= 4;

		System.out.println((int) (Math.pow(a, b) % 10));

	}
}
0