結果

問題 No.167 N^M mod 10
ユーザー t8m8⛄️
提出日時 2015-03-20 07:29:47
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 883 bytes
コンパイル時間 3,397 ms
コンパイル使用メモリ 75,888 KB
実行使用メモリ 52,448 KB
最終ジャッジ日時 2024-06-28 23:44:58
合計ジャッジ時間 5,953 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 4 RE * 14
権限があれば一括ダウンロードができます

ソースコード

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));
        int n = Integer.parseInt(br.readLine())%10;
        int m = Integer.parseInt(br.readLine())%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