結果

問題 No.167 N^M mod 10
ユーザー kenkooookenkoooo
提出日時 2015-03-19 23:39:55
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 508 bytes
コンパイル時間 5,111 ms
コンパイル使用メモリ 71,428 KB
実行使用メモリ 58,372 KB
最終ジャッジ日時 2023-09-11 08:42:58
合計ジャッジ時間 7,264 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 152 ms
56,124 KB
testcase_03 AC 155 ms
58,144 KB
testcase_04 WA -
testcase_05 AC 121 ms
55,716 KB
testcase_06 WA -
testcase_07 AC 124 ms
55,628 KB
testcase_08 AC 121 ms
55,332 KB
testcase_09 AC 122 ms
55,652 KB
testcase_10 WA -
testcase_11 AC 121 ms
55,588 KB
testcase_12 AC 120 ms
55,504 KB
testcase_13 WA -
testcase_14 AC 122 ms
55,508 KB
testcase_15 AC 121 ms
55,716 KB
testcase_16 AC 121 ms
55,588 KB
testcase_17 AC 121 ms
55,712 KB
testcase_18 AC 121 ms
55,652 KB
testcase_19 AC 123 ms
55,552 KB
testcase_20 AC 124 ms
55,556 KB
testcase_21 AC 125 ms
55,772 KB
testcase_22 AC 156 ms
55,852 KB
testcase_23 AC 158 ms
56,216 KB
testcase_24 AC 155 ms
56,208 KB
testcase_25 AC 155 ms
56,348 KB
testcase_26 AC 137 ms
55,956 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);
		char[] N = sc.next().toCharArray();
		String mString = sc.next();
		sc.close();
		int a = Character.getNumericValue(N[N.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