結果

問題 No.747 循環小数N桁目 Hard
ユーザー tentententen
提出日時 2023-04-24 14:47:18
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 2,125 bytes
コンパイル時間 2,684 ms
コンパイル使用メモリ 83,248 KB
実行使用メモリ 53,504 KB
最終ジャッジ日時 2024-04-26 04:09:48
合計ジャッジ時間 16,745 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
50,516 KB
testcase_01 WA -
testcase_02 AC 54 ms
50,284 KB
testcase_03 AC 53 ms
50,312 KB
testcase_04 AC 53 ms
50,228 KB
testcase_05 WA -
testcase_06 AC 56 ms
50,412 KB
testcase_07 AC 53 ms
50,272 KB
testcase_08 AC 57 ms
50,140 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 54 ms
50,508 KB
testcase_12 AC 53 ms
50,476 KB
testcase_13 AC 54 ms
50,192 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 53 ms
50,180 KB
testcase_17 WA -
testcase_18 AC 53 ms
50,428 KB
testcase_19 AC 52 ms
50,272 KB
testcase_20 AC 53 ms
50,184 KB
testcase_21 WA -
testcase_22 AC 53 ms
50,252 KB
testcase_23 AC 52 ms
50,520 KB
testcase_24 AC 53 ms
50,668 KB
testcase_25 AC 52 ms
50,532 KB
testcase_26 AC 53 ms
50,532 KB
testcase_27 AC 55 ms
50,048 KB
testcase_28 AC 54 ms
50,260 KB
testcase_29 AC 55 ms
50,568 KB
testcase_30 AC 54 ms
50,488 KB
testcase_31 AC 54 ms
50,392 KB
testcase_32 AC 55 ms
50,404 KB
testcase_33 AC 101 ms
51,776 KB
testcase_34 AC 69 ms
50,804 KB
testcase_35 AC 73 ms
50,952 KB
testcase_36 AC 72 ms
50,844 KB
testcase_37 AC 63 ms
50,380 KB
testcase_38 AC 74 ms
50,852 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 98 ms
52,040 KB
testcase_42 AC 95 ms
52,228 KB
testcase_43 WA -
testcase_44 AC 94 ms
51,860 KB
testcase_45 AC 99 ms
52,180 KB
testcase_46 WA -
testcase_47 AC 98 ms
51,812 KB
testcase_48 AC 75 ms
51,012 KB
testcase_49 AC 94 ms
51,724 KB
testcase_50 AC 75 ms
50,960 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 111 ms
52,264 KB
testcase_55 AC 138 ms
53,276 KB
testcase_56 AC 115 ms
51,964 KB
testcase_57 AC 72 ms
50,944 KB
testcase_58 AC 140 ms
52,624 KB
testcase_59 AC 87 ms
51,792 KB
testcase_60 AC 140 ms
53,324 KB
testcase_61 AC 101 ms
51,564 KB
testcase_62 AC 103 ms
52,024 KB
testcase_63 AC 99 ms
52,224 KB
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 AC 96 ms
52,020 KB
testcase_69 AC 96 ms
51,956 KB
testcase_70 WA -
testcase_71 AC 80 ms
51,220 KB
testcase_72 AC 77 ms
50,824 KB
testcase_73 AC 98 ms
51,968 KB
testcase_74 AC 94 ms
52,228 KB
testcase_75 WA -
testcase_76 AC 77 ms
50,820 KB
testcase_77 AC 75 ms
51,032 KB
testcase_78 WA -
testcase_79 AC 89 ms
51,492 KB
testcase_80 AC 94 ms
52,144 KB
testcase_81 AC 69 ms
51,048 KB
testcase_82 WA -
testcase_83 AC 70 ms
50,996 KB
testcase_84 WA -
testcase_85 WA -
testcase_86 WA -
testcase_87 WA -
testcase_88 AC 77 ms
51,104 KB
testcase_89 AC 76 ms
51,004 KB
testcase_90 AC 100 ms
51,576 KB
testcase_91 AC 98 ms
51,852 KB
testcase_92 AC 74 ms
50,952 KB
testcase_93 AC 85 ms
51,264 KB
testcase_94 AC 106 ms
52,268 KB
testcase_95 AC 116 ms
52,260 KB
testcase_96 AC 113 ms
52,388 KB
testcase_97 AC 117 ms
52,300 KB
testcase_98 AC 131 ms
52,052 KB
testcase_99 WA -
testcase_100 AC 116 ms
52,412 KB
testcase_101 WA -
testcase_102 AC 84 ms
51,072 KB
testcase_103 AC 99 ms
52,300 KB
testcase_104 AC 100 ms
51,904 KB
testcase_105 WA -
testcase_106 AC 99 ms
52,036 KB
testcase_107 AC 101 ms
52,140 KB
testcase_108 AC 100 ms
51,908 KB
testcase_109 WA -
testcase_110 AC 101 ms
52,092 KB
testcase_111 AC 99 ms
52,124 KB
testcase_112 AC 99 ms
52,104 KB
testcase_113 AC 100 ms
52,076 KB
testcase_114 WA -
testcase_115 WA -
testcase_116 WA -
testcase_117 AC 100 ms
52,184 KB
testcase_118 WA -
testcase_119 AC 99 ms
52,292 KB
testcase_120 WA -
testcase_121 AC 98 ms
51,948 KB
testcase_122 WA -
testcase_123 AC 99 ms
52,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {
    static int[] base = new int[]{2, 8, 5, 7, 1, 4};
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = 0;
        for (char c : sc.next().toCharArray()) {
            n *= 10;
            n += c - '0';
            n %= base.length;
        }
        n += base.length - 1;
        n %= base.length;
        char[] inputs = sc.next().toCharArray();
        int ans = 1;
        for (int i = inputs.length - 1; i >= 0; i--) {
            ans *= pow(n, inputs[i] - '0');
            ans %= base.length;
            n = pow(n, 10);
        }
        System.out.println(base[ans]);
    }
    
    static int pow(int x, int p) {
        if (p == 0) {
            return 1;
        } else {
            return pow(x, p - 1) * x % base.length;
        }
    }
}
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0