結果
問題 | No.167 N^M mod 10 |
ユーザー |
![]() |
提出日時 | 2015-03-20 07:46:39 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 168 ms / 1,000 ms |
コード長 | 898 bytes |
コンパイル時間 | 3,556 ms |
コンパイル使用メモリ | 75,500 KB |
実行使用メモリ | 39,716 KB |
最終ジャッジ日時 | 2024-09-22 01:10:43 |
合計ジャッジ時間 | 6,462 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
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)); BigInteger n = new BigInteger(br.readLine()); BigInteger m = new BigInteger(br.readLine()); out.println(n.modPow(m,BigInteger.TEN)); } 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));} }