結果
問題 | No.747 循環小数N桁目 Hard |
ユーザー | tenten |
提出日時 | 2020-09-01 17:22:10 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 216 ms / 2,000 ms |
コード長 | 643 bytes |
コンパイル時間 | 2,719 ms |
コンパイル使用メモリ | 74,600 KB |
実行使用メモリ | 54,756 KB |
最終ジャッジ日時 | 2024-11-19 10:57:53 |
合計ジャッジ時間 | 26,829 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 131 ms
54,084 KB |
testcase_01 | AC | 131 ms
53,852 KB |
testcase_02 | AC | 130 ms
53,980 KB |
testcase_03 | AC | 129 ms
53,968 KB |
testcase_04 | AC | 129 ms
53,968 KB |
testcase_05 | AC | 130 ms
54,092 KB |
testcase_06 | AC | 131 ms
53,984 KB |
testcase_07 | AC | 129 ms
53,928 KB |
testcase_08 | AC | 131 ms
53,884 KB |
testcase_09 | AC | 130 ms
54,116 KB |
testcase_10 | AC | 131 ms
54,080 KB |
testcase_11 | AC | 131 ms
53,812 KB |
testcase_12 | AC | 130 ms
54,068 KB |
testcase_13 | AC | 129 ms
54,060 KB |
testcase_14 | AC | 131 ms
53,936 KB |
testcase_15 | AC | 132 ms
53,820 KB |
testcase_16 | AC | 130 ms
53,792 KB |
testcase_17 | AC | 129 ms
53,988 KB |
testcase_18 | AC | 130 ms
53,952 KB |
testcase_19 | AC | 131 ms
54,196 KB |
testcase_20 | AC | 129 ms
53,896 KB |
testcase_21 | AC | 129 ms
54,224 KB |
testcase_22 | AC | 135 ms
54,096 KB |
testcase_23 | AC | 131 ms
53,992 KB |
testcase_24 | AC | 132 ms
53,816 KB |
testcase_25 | AC | 128 ms
53,968 KB |
testcase_26 | AC | 133 ms
53,952 KB |
testcase_27 | AC | 127 ms
54,076 KB |
testcase_28 | AC | 128 ms
54,068 KB |
testcase_29 | AC | 133 ms
53,792 KB |
testcase_30 | AC | 129 ms
53,776 KB |
testcase_31 | AC | 132 ms
53,892 KB |
testcase_32 | AC | 130 ms
53,828 KB |
testcase_33 | AC | 190 ms
54,532 KB |
testcase_34 | AC | 169 ms
54,060 KB |
testcase_35 | AC | 175 ms
54,220 KB |
testcase_36 | AC | 183 ms
54,088 KB |
testcase_37 | AC | 161 ms
54,204 KB |
testcase_38 | AC | 182 ms
54,152 KB |
testcase_39 | AC | 176 ms
54,176 KB |
testcase_40 | AC | 197 ms
54,616 KB |
testcase_41 | AC | 199 ms
54,352 KB |
testcase_42 | AC | 196 ms
54,168 KB |
testcase_43 | AC | 183 ms
54,088 KB |
testcase_44 | AC | 183 ms
54,484 KB |
testcase_45 | AC | 191 ms
54,356 KB |
testcase_46 | AC | 179 ms
54,276 KB |
testcase_47 | AC | 190 ms
54,676 KB |
testcase_48 | AC | 171 ms
54,344 KB |
testcase_49 | AC | 184 ms
54,404 KB |
testcase_50 | AC | 175 ms
54,280 KB |
testcase_51 | AC | 179 ms
54,188 KB |
testcase_52 | AC | 168 ms
54,408 KB |
testcase_53 | AC | 199 ms
54,444 KB |
testcase_54 | AC | 194 ms
54,448 KB |
testcase_55 | AC | 213 ms
54,100 KB |
testcase_56 | AC | 211 ms
54,748 KB |
testcase_57 | AC | 176 ms
54,616 KB |
testcase_58 | AC | 207 ms
53,952 KB |
testcase_59 | AC | 185 ms
54,352 KB |
testcase_60 | AC | 204 ms
54,220 KB |
testcase_61 | AC | 196 ms
54,100 KB |
testcase_62 | AC | 191 ms
54,244 KB |
testcase_63 | AC | 200 ms
54,580 KB |
testcase_64 | AC | 183 ms
54,432 KB |
testcase_65 | AC | 146 ms
54,168 KB |
testcase_66 | AC | 188 ms
54,720 KB |
testcase_67 | AC | 186 ms
54,048 KB |
testcase_68 | AC | 201 ms
54,548 KB |
testcase_69 | AC | 193 ms
54,292 KB |
testcase_70 | AC | 173 ms
54,176 KB |
testcase_71 | AC | 172 ms
54,352 KB |
testcase_72 | AC | 184 ms
54,236 KB |
testcase_73 | AC | 193 ms
54,208 KB |
testcase_74 | AC | 188 ms
54,500 KB |
testcase_75 | AC | 177 ms
54,400 KB |
testcase_76 | AC | 184 ms
54,408 KB |
testcase_77 | AC | 180 ms
54,360 KB |
testcase_78 | AC | 200 ms
54,512 KB |
testcase_79 | AC | 178 ms
54,468 KB |
testcase_80 | AC | 201 ms
54,528 KB |
testcase_81 | AC | 172 ms
54,104 KB |
testcase_82 | AC | 166 ms
54,036 KB |
testcase_83 | AC | 170 ms
54,416 KB |
testcase_84 | AC | 203 ms
54,408 KB |
testcase_85 | AC | 192 ms
54,240 KB |
testcase_86 | AC | 177 ms
54,408 KB |
testcase_87 | AC | 199 ms
54,480 KB |
testcase_88 | AC | 184 ms
54,508 KB |
testcase_89 | AC | 173 ms
54,264 KB |
testcase_90 | AC | 189 ms
54,112 KB |
testcase_91 | AC | 198 ms
54,756 KB |
testcase_92 | AC | 187 ms
54,428 KB |
testcase_93 | AC | 195 ms
54,108 KB |
testcase_94 | AC | 216 ms
54,520 KB |
testcase_95 | AC | 203 ms
54,236 KB |
testcase_96 | AC | 213 ms
54,572 KB |
testcase_97 | AC | 203 ms
54,384 KB |
testcase_98 | AC | 207 ms
54,064 KB |
testcase_99 | AC | 200 ms
54,120 KB |
testcase_100 | AC | 206 ms
54,440 KB |
testcase_101 | AC | 196 ms
54,388 KB |
testcase_102 | AC | 196 ms
54,432 KB |
testcase_103 | AC | 200 ms
54,684 KB |
testcase_104 | AC | 201 ms
54,356 KB |
testcase_105 | AC | 201 ms
54,080 KB |
testcase_106 | AC | 202 ms
54,056 KB |
testcase_107 | AC | 196 ms
54,364 KB |
testcase_108 | AC | 201 ms
54,240 KB |
testcase_109 | AC | 204 ms
54,372 KB |
testcase_110 | AC | 199 ms
54,240 KB |
testcase_111 | AC | 205 ms
54,552 KB |
testcase_112 | AC | 205 ms
54,008 KB |
testcase_113 | AC | 203 ms
54,468 KB |
testcase_114 | AC | 207 ms
54,384 KB |
testcase_115 | AC | 202 ms
54,212 KB |
testcase_116 | AC | 204 ms
54,212 KB |
testcase_117 | AC | 202 ms
54,360 KB |
testcase_118 | AC | 199 ms
54,136 KB |
testcase_119 | AC | 202 ms
54,748 KB |
testcase_120 | AC | 203 ms
54,276 KB |
testcase_121 | AC | 195 ms
54,316 KB |
testcase_122 | AC | 199 ms
54,000 KB |
testcase_123 | AC | 203 ms
54,300 KB |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = getNum(sc.next().toCharArray()); int k = getNum(sc.next().toCharArray()); if (k == 0) { k = 6; } char[] arr = "285714".toCharArray(); int ans = 1; for (int i = 0; i < k; i++) { ans *= n; ans %= 6; } ans = (ans - 1 + 6) % 6; System.out.println(arr[ans]); } static int getNum(char[] arr) { int ans = 0; for (char c : arr) { ans = (ans * 10 + c - '0') % 6; } return ans; } }