結果
| 問題 |
No.747 循環小数N桁目 Hard
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-22 06:38:07 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 727 ms / 2,000 ms |
| コード長 | 730 bytes |
| コンパイル時間 | 2,342 ms |
| コンパイル使用メモリ | 75,204 KB |
| 実行使用メモリ | 43,976 KB |
| 最終ジャッジ日時 | 2024-12-24 16:45:40 |
| 合計ジャッジ時間 | 47,176 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 120 |
ソースコード
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(N.intValue()==0?4:ans[N.intValue()-1]);
}
static void tr(Object... objects) {
System.out.println(Arrays.deepToString(objects));
}
}