結果
問題 |
No.747 循環小数N桁目 Hard
|
ユーザー |
|
提出日時 | 2020-03-22 06:35:24 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 715 bytes |
コンパイル時間 | 2,397 ms |
コンパイル使用メモリ | 75,488 KB |
実行使用メモリ | 44,136 KB |
最終ジャッジ日時 | 2024-12-24 16:42:42 |
合計ジャッジ時間 | 48,435 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 105 RE * 15 |
ソースコード
import java.io.FileNotFoundException; import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) throws FileNotFoundException { long t = System.currentTimeMillis(); new Main().run(); System.err.println(System.currentTimeMillis() - t); } void run() { Scanner sc = new Scanner(System.in); BigInteger N=new BigInteger(sc.next()).mod(BigInteger.valueOf(6)); BigInteger K=new BigInteger(sc.next()); N=N.modPow(K, BigInteger.valueOf(6)); int[] ans=new int[] {2,8,5,7,1,4}; System.out.println(ans[N.intValue()-1]); } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }