結果

問題 No.167 N^M mod 10
ユーザー kenkooookenkoooo
提出日時 2015-03-19 23:37:47
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 521 bytes
コンパイル時間 2,034 ms
コンパイル使用メモリ 72,316 KB
実行使用メモリ 57,116 KB
最終ジャッジ日時 2023-09-11 08:42:36
合計ジャッジ時間 7,135 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 153 ms
56,196 KB
testcase_03 AC 154 ms
56,540 KB
testcase_04 WA -
testcase_05 AC 119 ms
55,656 KB
testcase_06 WA -
testcase_07 AC 121 ms
55,824 KB
testcase_08 AC 121 ms
56,076 KB
testcase_09 AC 120 ms
55,904 KB
testcase_10 WA -
testcase_11 AC 119 ms
55,656 KB
testcase_12 AC 119 ms
55,660 KB
testcase_13 WA -
testcase_14 AC 120 ms
56,088 KB
testcase_15 AC 120 ms
55,996 KB
testcase_16 AC 121 ms
55,912 KB
testcase_17 AC 117 ms
55,764 KB
testcase_18 AC 118 ms
55,904 KB
testcase_19 AC 119 ms
55,796 KB
testcase_20 AC 122 ms
55,872 KB
testcase_21 AC 121 ms
55,892 KB
testcase_22 AC 155 ms
56,412 KB
testcase_23 AC 154 ms
56,328 KB
testcase_24 AC 155 ms
56,380 KB
testcase_25 AC 154 ms
56,580 KB
testcase_26 AC 140 ms
55,836 KB
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 = 0;
		if (mString.length() > 2) {
			b = Integer.parseInt(mString.substring(mString.length() - 2, mString.length()));
		} else {
			b = Integer.parseInt(mString);
		}
		b %= 4;

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

	}
}
0