結果

問題 No.167 N^M mod 10
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-03-20 07:36:54
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 987 bytes
コンパイル時間 3,390 ms
コンパイル使用メモリ 73,320 KB
実行使用メモリ 51,328 KB
最終ジャッジ日時 2023-09-11 09:03:26
合計ジャッジ時間 5,991 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 46 ms
49,308 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 RE -
testcase_08 AC 44 ms
49,176 KB
testcase_09 WA -
testcase_10 RE -
testcase_11 AC 43 ms
49,292 KB
testcase_12 RE -
testcase_13 AC 43 ms
49,220 KB
testcase_14 RE -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 43 ms
49,408 KB
testcase_18 WA -
testcase_19 AC 43 ms
49,352 KB
testcase_20 AC 44 ms
49,324 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 RE -
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.BigInteger;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class No167 {

    static final InputStream in = System.in;
    static final PrintWriter out = new PrintWriter(System.out,false);

    static void solve() throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input = br.readLine();
        int n = Integer.parseInt(input.substring(input.length()-1));
        input = br.readLine();
        int m = Integer.parseInt(input.substring(input.length()-2));
        out.println((int)pow(n,m)%10);
    }

    public static void main(String[] args) throws Exception {
        long start = System.currentTimeMillis();

        solve();
        out.flush();

        long end = System.currentTimeMillis();
        //trace(end-start + "ms");
        in.close();
    }

    static void trace(Object... o) { System.out.println(deepToString(o));}
}
0