結果

問題 No.167 N^M mod 10
ユーザー uafr_csuafr_cs
提出日時 2015-06-09 02:41:42
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 830 bytes
コンパイル時間 2,175 ms
コンパイル使用メモリ 78,804 KB
実行使用メモリ 56,764 KB
最終ジャッジ日時 2023-09-20 20:06:05
合計ジャッジ時間 7,276 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
55,532 KB
testcase_01 AC 110 ms
55,432 KB
testcase_02 AC 153 ms
56,256 KB
testcase_03 AC 147 ms
56,624 KB
testcase_04 AC 151 ms
56,324 KB
testcase_05 AC 113 ms
56,052 KB
testcase_06 AC 112 ms
55,844 KB
testcase_07 AC 110 ms
55,912 KB
testcase_08 AC 110 ms
55,676 KB
testcase_09 AC 112 ms
55,576 KB
testcase_10 WA -
testcase_11 AC 110 ms
56,192 KB
testcase_12 AC 109 ms
56,164 KB
testcase_13 AC 110 ms
55,892 KB
testcase_14 WA -
testcase_15 AC 108 ms
55,852 KB
testcase_16 AC 110 ms
55,896 KB
testcase_17 AC 111 ms
55,796 KB
testcase_18 AC 111 ms
56,016 KB
testcase_19 AC 109 ms
55,392 KB
testcase_20 AC 113 ms
56,596 KB
testcase_21 AC 110 ms
55,620 KB
testcase_22 AC 150 ms
56,468 KB
testcase_23 AC 152 ms
56,276 KB
testcase_24 AC 151 ms
56,332 KB
testcase_25 AC 146 ms
56,256 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 145 ms
56,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String N = sc.next();
		String M = sc.next();
		
		int[][] answers = {
				{0},
				{1},
				{2, 4, 8, 6},
				{3, 9, 7, 1},
				{4, 6},
				{5},
				{6},
				{7, 9, 3, 1},
				{8, 4, 2, 1},
				{9, 1},
		};
		
		final int N_mod_10 = Integer.parseInt(N.substring(N.length() - 1));
		final int M_mod_100 = Integer.parseInt(M.substring(Math.max(0, M.length() - 2)));
		
		//System.out.println(N_mod_10 + ":" + M_mod_100);
		System.out.println(answers[N_mod_10]["0".equals(M) ? 0 : (100 + M_mod_100 - 1) % answers[N_mod_10].length]);
		
	}
	
}
0