結果

問題 No.167 N^M mod 10
ユーザー crazybbb3crazybbb3
提出日時 2017-01-29 01:06:11
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 2,170 bytes
コンパイル時間 2,280 ms
コンパイル使用メモリ 77,440 KB
実行使用メモリ 50,620 KB
最終ジャッジ日時 2023-08-25 13:35:03
合計ジャッジ時間 5,255 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
49,828 KB
testcase_01 AC 45 ms
49,912 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 48 ms
49,736 KB
testcase_05 AC 43 ms
49,956 KB
testcase_06 AC 45 ms
49,728 KB
testcase_07 AC 43 ms
49,908 KB
testcase_08 AC 44 ms
50,412 KB
testcase_09 AC 43 ms
50,208 KB
testcase_10 AC 43 ms
49,752 KB
testcase_11 AC 46 ms
49,744 KB
testcase_12 AC 44 ms
49,912 KB
testcase_13 AC 45 ms
49,876 KB
testcase_14 WA -
testcase_15 AC 46 ms
49,852 KB
testcase_16 AC 43 ms
49,908 KB
testcase_17 AC 43 ms
50,000 KB
testcase_18 AC 43 ms
50,328 KB
testcase_19 AC 45 ms
50,072 KB
testcase_20 AC 43 ms
49,852 KB
testcase_21 AC 44 ms
49,796 KB
testcase_22 AC 48 ms
49,864 KB
testcase_23 AC 50 ms
49,804 KB
testcase_24 AC 48 ms
50,092 KB
testcase_25 AC 50 ms
50,232 KB
testcase_26 WA -
testcase_27 AC 49 ms
50,324 KB
testcase_28 AC 49 ms
49,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {

    void solve() throws IOException {
        int[][] t = {
                {0, 0, 0, 0},
                {1, 1, 1, 1},
                {6, 2, 4, 7},
                {1, 3, 9, 7},
                {6, 4, 6, 4},
                {5, 5, 5, 5},
                {6, 6, 6, 6},
                {1, 7, 9, 3},
                {6, 8, 4, 2},
                {1, 9, 1, 9}
        };

        String n = ns(), m = "0" + ns();
        int nn = Integer.valueOf(n.substring(n.length() - 1));
        int mm = Integer.valueOf(m.substring(m.length() - 2)) % 4;
        out.println(t[nn][mm]);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}
0