結果

問題 No.167 N^M mod 10
ユーザー kou6839kou6839
提出日時 2015-03-20 00:04:24
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 466 bytes
コンパイル時間 2,275 ms
コンパイル使用メモリ 74,808 KB
実行使用メモリ 56,784 KB
最終ジャッジ日時 2023-09-11 08:50:51
合計ジャッジ時間 7,379 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 155 ms
56,784 KB
testcase_03 AC 155 ms
56,448 KB
testcase_04 WA -
testcase_05 AC 121 ms
56,160 KB
testcase_06 WA -
testcase_07 AC 124 ms
55,988 KB
testcase_08 AC 122 ms
55,792 KB
testcase_09 AC 123 ms
55,732 KB
testcase_10 AC 123 ms
55,488 KB
testcase_11 AC 124 ms
55,848 KB
testcase_12 AC 122 ms
55,756 KB
testcase_13 AC 122 ms
56,040 KB
testcase_14 AC 124 ms
55,740 KB
testcase_15 AC 123 ms
56,088 KB
testcase_16 AC 123 ms
55,724 KB
testcase_17 AC 120 ms
55,884 KB
testcase_18 AC 121 ms
55,392 KB
testcase_19 AC 120 ms
55,948 KB
testcase_20 AC 122 ms
55,752 KB
testcase_21 AC 123 ms
55,896 KB
testcase_22 AC 154 ms
56,608 KB
testcase_23 AC 156 ms
56,608 KB
testcase_24 AC 154 ms
56,676 KB
testcase_25 AC 155 ms
56,192 KB
testcase_26 AC 137 ms
54,216 KB
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;


public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String a=sc.next();
		String b = sc.next();
		long c = Integer.parseInt(a.charAt(a.length()-1)+"");
		long aa = 0;
		if(b.length()>1){
			aa = Integer.parseInt(b.substring(b.length()-2, b.length()));
		}else{
			aa=Integer.parseInt(b.charAt(b.length()-1)+"");
		}
		aa-=1;
		aa%=4;
		aa++;
		System.out.println((int)(Math.pow(c, aa)%10));
	}
}
0