結果
問題 | No.747 循環小数N桁目 Hard |
ユーザー | tenten |
提出日時 | 2023-04-24 14:47:18 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,125 bytes |
コンパイル時間 | 3,243 ms |
コンパイル使用メモリ | 83,020 KB |
実行使用メモリ | 40,188 KB |
最終ジャッジ日時 | 2024-11-08 16:42:28 |
合計ジャッジ時間 | 17,102 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 52 ms
36,580 KB |
testcase_01 | WA | - |
testcase_02 | AC | 52 ms
37,096 KB |
testcase_03 | AC | 51 ms
37,112 KB |
testcase_04 | AC | 51 ms
36,860 KB |
testcase_05 | WA | - |
testcase_06 | AC | 53 ms
37,076 KB |
testcase_07 | AC | 53 ms
36,864 KB |
testcase_08 | AC | 52 ms
37,108 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 52 ms
37,264 KB |
testcase_12 | AC | 52 ms
37,040 KB |
testcase_13 | AC | 52 ms
36,600 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 53 ms
36,856 KB |
testcase_17 | WA | - |
testcase_18 | AC | 52 ms
37,080 KB |
testcase_19 | AC | 51 ms
37,060 KB |
testcase_20 | AC | 53 ms
37,208 KB |
testcase_21 | WA | - |
testcase_22 | AC | 52 ms
36,864 KB |
testcase_23 | AC | 51 ms
37,116 KB |
testcase_24 | AC | 52 ms
37,020 KB |
testcase_25 | AC | 52 ms
36,928 KB |
testcase_26 | AC | 50 ms
37,120 KB |
testcase_27 | AC | 52 ms
37,112 KB |
testcase_28 | AC | 52 ms
37,096 KB |
testcase_29 | AC | 53 ms
37,148 KB |
testcase_30 | AC | 52 ms
37,164 KB |
testcase_31 | AC | 52 ms
36,856 KB |
testcase_32 | AC | 53 ms
36,604 KB |
testcase_33 | AC | 96 ms
38,488 KB |
testcase_34 | AC | 68 ms
37,636 KB |
testcase_35 | AC | 69 ms
37,704 KB |
testcase_36 | AC | 71 ms
37,884 KB |
testcase_37 | AC | 59 ms
37,316 KB |
testcase_38 | AC | 73 ms
37,648 KB |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | AC | 96 ms
39,160 KB |
testcase_42 | AC | 92 ms
39,072 KB |
testcase_43 | WA | - |
testcase_44 | AC | 93 ms
38,928 KB |
testcase_45 | AC | 96 ms
38,676 KB |
testcase_46 | WA | - |
testcase_47 | AC | 97 ms
38,756 KB |
testcase_48 | AC | 74 ms
37,768 KB |
testcase_49 | AC | 76 ms
37,976 KB |
testcase_50 | AC | 75 ms
37,752 KB |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | AC | 108 ms
39,120 KB |
testcase_55 | AC | 112 ms
39,436 KB |
testcase_56 | AC | 115 ms
39,276 KB |
testcase_57 | AC | 70 ms
37,760 KB |
testcase_58 | AC | 138 ms
39,508 KB |
testcase_59 | AC | 86 ms
38,592 KB |
testcase_60 | AC | 115 ms
39,676 KB |
testcase_61 | AC | 99 ms
38,992 KB |
testcase_62 | AC | 104 ms
38,892 KB |
testcase_63 | AC | 98 ms
39,056 KB |
testcase_64 | WA | - |
testcase_65 | WA | - |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | AC | 97 ms
38,752 KB |
testcase_69 | AC | 93 ms
39,036 KB |
testcase_70 | WA | - |
testcase_71 | AC | 68 ms
37,752 KB |
testcase_72 | AC | 76 ms
37,496 KB |
testcase_73 | AC | 97 ms
38,928 KB |
testcase_74 | AC | 83 ms
38,144 KB |
testcase_75 | WA | - |
testcase_76 | AC | 75 ms
37,808 KB |
testcase_77 | AC | 73 ms
38,012 KB |
testcase_78 | WA | - |
testcase_79 | AC | 76 ms
37,888 KB |
testcase_80 | AC | 97 ms
39,348 KB |
testcase_81 | AC | 68 ms
37,516 KB |
testcase_82 | WA | - |
testcase_83 | AC | 70 ms
38,180 KB |
testcase_84 | WA | - |
testcase_85 | WA | - |
testcase_86 | WA | - |
testcase_87 | WA | - |
testcase_88 | AC | 74 ms
37,912 KB |
testcase_89 | AC | 75 ms
37,780 KB |
testcase_90 | AC | 93 ms
39,044 KB |
testcase_91 | AC | 98 ms
39,068 KB |
testcase_92 | AC | 71 ms
37,984 KB |
testcase_93 | AC | 91 ms
39,036 KB |
testcase_94 | AC | 104 ms
39,264 KB |
testcase_95 | AC | 114 ms
39,404 KB |
testcase_96 | AC | 108 ms
39,552 KB |
testcase_97 | AC | 110 ms
39,256 KB |
testcase_98 | AC | 139 ms
39,964 KB |
testcase_99 | WA | - |
testcase_100 | AC | 125 ms
39,728 KB |
testcase_101 | WA | - |
testcase_102 | AC | 92 ms
38,800 KB |
testcase_103 | AC | 97 ms
39,340 KB |
testcase_104 | AC | 96 ms
39,200 KB |
testcase_105 | WA | - |
testcase_106 | AC | 98 ms
39,192 KB |
testcase_107 | AC | 97 ms
39,324 KB |
testcase_108 | AC | 98 ms
39,160 KB |
testcase_109 | WA | - |
testcase_110 | AC | 113 ms
39,196 KB |
testcase_111 | AC | 102 ms
39,028 KB |
testcase_112 | AC | 97 ms
38,976 KB |
testcase_113 | AC | 98 ms
39,272 KB |
testcase_114 | WA | - |
testcase_115 | WA | - |
testcase_116 | WA | - |
testcase_117 | AC | 97 ms
39,052 KB |
testcase_118 | WA | - |
testcase_119 | AC | 92 ms
39,240 KB |
testcase_120 | WA | - |
testcase_121 | AC | 98 ms
39,136 KB |
testcase_122 | WA | - |
testcase_123 | AC | 94 ms
39,416 KB |
ソースコード
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(); } }