結果
問題 | No.308 素数は通れません |
ユーザー | 0w1 |
提出日時 | 2017-04-15 18:56:00 |
言語 | PyPy2 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 587 bytes |
コンパイル時間 | 237 ms |
コンパイル使用メモリ | 77,056 KB |
実行使用メモリ | 91,904 KB |
最終ジャッジ日時 | 2024-07-18 18:00:04 |
合計ジャッジ時間 | 19,057 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 128 ms
91,012 KB |
testcase_01 | AC | 130 ms
91,020 KB |
testcase_02 | AC | 127 ms
91,016 KB |
testcase_03 | AC | 129 ms
91,136 KB |
testcase_04 | AC | 130 ms
91,580 KB |
testcase_05 | AC | 134 ms
91,148 KB |
testcase_06 | AC | 130 ms
91,028 KB |
testcase_07 | AC | 130 ms
91,536 KB |
testcase_08 | AC | 135 ms
91,536 KB |
testcase_09 | AC | 133 ms
90,904 KB |
testcase_10 | AC | 130 ms
91,064 KB |
testcase_11 | AC | 130 ms
91,392 KB |
testcase_12 | AC | 134 ms
91,552 KB |
testcase_13 | AC | 133 ms
90,920 KB |
testcase_14 | AC | 129 ms
91,128 KB |
testcase_15 | AC | 130 ms
91,180 KB |
testcase_16 | AC | 130 ms
91,308 KB |
testcase_17 | AC | 130 ms
91,136 KB |
testcase_18 | AC | 130 ms
91,136 KB |
testcase_19 | AC | 133 ms
91,556 KB |
testcase_20 | AC | 134 ms
91,024 KB |
testcase_21 | AC | 134 ms
91,436 KB |
testcase_22 | AC | 136 ms
91,392 KB |
testcase_23 | AC | 133 ms
91,156 KB |
testcase_24 | AC | 132 ms
91,300 KB |
testcase_25 | AC | 129 ms
91,196 KB |
testcase_26 | AC | 130 ms
90,904 KB |
testcase_27 | AC | 135 ms
91,040 KB |
testcase_28 | AC | 137 ms
91,148 KB |
testcase_29 | AC | 134 ms
90,900 KB |
testcase_30 | AC | 136 ms
91,188 KB |
testcase_31 | AC | 138 ms
91,272 KB |
testcase_32 | AC | 141 ms
91,136 KB |
testcase_33 | AC | 141 ms
91,276 KB |
testcase_34 | AC | 147 ms
91,136 KB |
testcase_35 | AC | 136 ms
91,676 KB |
testcase_36 | AC | 138 ms
91,136 KB |
testcase_37 | AC | 137 ms
90,924 KB |
testcase_38 | AC | 135 ms
91,020 KB |
testcase_39 | AC | 135 ms
91,660 KB |
testcase_40 | AC | 132 ms
91,136 KB |
testcase_41 | AC | 132 ms
91,184 KB |
testcase_42 | AC | 129 ms
91,036 KB |
testcase_43 | AC | 131 ms
91,136 KB |
testcase_44 | AC | 138 ms
91,520 KB |
testcase_45 | AC | 130 ms
91,136 KB |
testcase_46 | AC | 134 ms
91,136 KB |
testcase_47 | AC | 133 ms
91,392 KB |
testcase_48 | AC | 140 ms
91,136 KB |
testcase_49 | AC | 130 ms
90,920 KB |
testcase_50 | AC | 133 ms
91,136 KB |
testcase_51 | AC | 136 ms
91,180 KB |
testcase_52 | AC | 144 ms
91,036 KB |
testcase_53 | AC | 135 ms
91,264 KB |
testcase_54 | AC | 131 ms
91,176 KB |
testcase_55 | AC | 132 ms
91,392 KB |
testcase_56 | AC | 131 ms
91,188 KB |
testcase_57 | AC | 130 ms
91,560 KB |
testcase_58 | AC | 130 ms
91,184 KB |
testcase_59 | AC | 132 ms
91,520 KB |
testcase_60 | AC | 134 ms
91,020 KB |
testcase_61 | AC | 133 ms
91,008 KB |
testcase_62 | AC | 136 ms
91,548 KB |
testcase_63 | AC | 136 ms
90,916 KB |
testcase_64 | AC | 133 ms
91,552 KB |
testcase_65 | AC | 130 ms
91,452 KB |
testcase_66 | AC | 131 ms
91,136 KB |
testcase_67 | AC | 132 ms
90,908 KB |
testcase_68 | AC | 134 ms
91,064 KB |
testcase_69 | AC | 130 ms
91,276 KB |
testcase_70 | AC | 130 ms
90,792 KB |
testcase_71 | AC | 134 ms
91,136 KB |
testcase_72 | AC | 130 ms
91,136 KB |
testcase_73 | AC | 134 ms
91,536 KB |
testcase_74 | AC | 133 ms
90,892 KB |
testcase_75 | AC | 132 ms
91,528 KB |
testcase_76 | AC | 132 ms
90,912 KB |
testcase_77 | AC | 135 ms
91,136 KB |
testcase_78 | AC | 133 ms
91,136 KB |
testcase_79 | AC | 133 ms
91,568 KB |
testcase_80 | AC | 147 ms
91,456 KB |
testcase_81 | AC | 135 ms
91,180 KB |
testcase_82 | AC | 136 ms
90,928 KB |
testcase_83 | AC | 131 ms
91,664 KB |
testcase_84 | AC | 131 ms
90,812 KB |
testcase_85 | AC | 132 ms
91,136 KB |
testcase_86 | AC | 136 ms
91,192 KB |
testcase_87 | AC | 132 ms
91,688 KB |
testcase_88 | AC | 135 ms
91,296 KB |
testcase_89 | AC | 134 ms
90,940 KB |
testcase_90 | AC | 132 ms
91,040 KB |
testcase_91 | AC | 130 ms
91,180 KB |
testcase_92 | AC | 130 ms
91,128 KB |
testcase_93 | AC | 134 ms
91,272 KB |
testcase_94 | AC | 136 ms
91,520 KB |
testcase_95 | AC | 131 ms
91,036 KB |
testcase_96 | AC | 130 ms
91,528 KB |
testcase_97 | AC | 132 ms
91,520 KB |
testcase_98 | AC | 129 ms
91,288 KB |
testcase_99 | AC | 130 ms
91,528 KB |
testcase_100 | WA | - |
testcase_101 | AC | 133 ms
91,576 KB |
testcase_102 | AC | 131 ms
90,908 KB |
testcase_103 | AC | 132 ms
91,052 KB |
testcase_104 | AC | 129 ms
91,288 KB |
testcase_105 | AC | 131 ms
91,164 KB |
testcase_106 | AC | 132 ms
91,020 KB |
ソースコード
import random def isprime(n): if n <= 1 or (n > 2 and n % 2 == 0): return False for _ in xrange(100): b = random.randint(2, n - 2) if pow( b, n - 1, n ) != 1: return False return True ans = [1,1,1,3,1,5,1,7,7,7,1,11,1,13,7,7,1,8,1,19,19,7,1,23,23,8,8,8,1,8,1,8,8,8,8,8,1,8,8,8,1,8,1,8,8,8,1,8,14,8,8,8,1,8,8,8,8,8,1,8,1,8,8,8,8,8,1,8,8,8,1,8,1,8,8,8,8,8,1,8,14,8,1,8,8,8,8,8,1,8,8,8,8,8,8,8,1,8,8] n = input() if n < 100: print ans[n - 1] else: if n % 8 != 1: print 8 elif not isprime(n - 8): print 8 else: print 14