結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
55,868 KB
testcase_01 AC 109 ms
55,640 KB
testcase_02 AC 148 ms
56,408 KB
testcase_03 AC 151 ms
56,196 KB
testcase_04 AC 147 ms
56,244 KB
testcase_05 AC 112 ms
55,596 KB
testcase_06 AC 110 ms
55,648 KB
testcase_07 AC 110 ms
53,880 KB
testcase_08 AC 113 ms
55,804 KB
testcase_09 AC 110 ms
55,416 KB
testcase_10 AC 111 ms
55,880 KB
testcase_11 AC 122 ms
55,700 KB
testcase_12 AC 109 ms
55,956 KB
testcase_13 AC 108 ms
56,372 KB
testcase_14 WA -
testcase_15 AC 107 ms
55,472 KB
testcase_16 AC 109 ms
55,732 KB
testcase_17 AC 111 ms
55,720 KB
testcase_18 AC 109 ms
55,804 KB
testcase_19 AC 107 ms
55,632 KB
testcase_20 AC 110 ms
55,956 KB
testcase_21 AC 109 ms
55,468 KB
testcase_22 AC 146 ms
56,788 KB
testcase_23 AC 148 ms
56,200 KB
testcase_24 AC 150 ms
56,268 KB
testcase_25 AC 148 ms
56,460 KB
testcase_26 WA -
testcase_27 AC 147 ms
56,500 KB
testcase_28 AC 145 ms
56,100 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, 6},
				{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