結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 156 ms
56,464 KB
testcase_03 AC 153 ms
56,808 KB
testcase_04 WA -
testcase_05 AC 121 ms
55,636 KB
testcase_06 WA -
testcase_07 AC 122 ms
55,840 KB
testcase_08 AC 122 ms
55,808 KB
testcase_09 AC 122 ms
55,920 KB
testcase_10 AC 121 ms
55,772 KB
testcase_11 AC 123 ms
56,008 KB
testcase_12 AC 122 ms
55,924 KB
testcase_13 AC 123 ms
55,872 KB
testcase_14 AC 124 ms
55,788 KB
testcase_15 AC 122 ms
55,828 KB
testcase_16 AC 121 ms
55,820 KB
testcase_17 AC 125 ms
56,084 KB
testcase_18 AC 122 ms
55,784 KB
testcase_19 AC 120 ms
53,704 KB
testcase_20 AC 126 ms
55,736 KB
testcase_21 AC 123 ms
55,712 KB
testcase_22 AC 156 ms
56,844 KB
testcase_23 AC 157 ms
56,104 KB
testcase_24 AC 158 ms
56,648 KB
testcase_25 AC 159 ms
56,740 KB
testcase_26 AC 141 ms
55,904 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 = Long.parseLong(a.charAt(a.length()-1)+"");
		long aa = 0;
		if(b.length()>1){
			aa = Long.parseLong(b.substring(b.length()-2, b.length()));
		}else{
			aa=Long.parseLong(b.charAt(b.length()-1)+"");
		}
		aa-=1;
		aa%=4;
		aa++;
		System.out.println((int)(Math.pow(c, aa)%10));
	}
}
0