結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 46 ms
49,200 KB
testcase_03 AC 46 ms
49,376 KB
testcase_04 WA -
testcase_05 AC 44 ms
49,376 KB
testcase_06 WA -
testcase_07 RE -
testcase_08 AC 45 ms
49,180 KB
testcase_09 AC 44 ms
49,172 KB
testcase_10 RE -
testcase_11 AC 44 ms
49,152 KB
testcase_12 RE -
testcase_13 WA -
testcase_14 RE -
testcase_15 AC 44 ms
49,524 KB
testcase_16 AC 44 ms
49,152 KB
testcase_17 AC 44 ms
49,500 KB
testcase_18 AC 44 ms
49,272 KB
testcase_19 AC 45 ms
49,512 KB
testcase_20 AC 44 ms
49,356 KB
testcase_21 AC 44 ms
49,528 KB
testcase_22 AC 47 ms
49,668 KB
testcase_23 AC 46 ms
49,244 KB
testcase_24 AC 46 ms
49,604 KB
testcase_25 AC 47 ms
49,408 KB
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))%4;
        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