結果

問題 No.6 使いものにならないハッシュ
ユーザー mlihua09mlihua09
提出日時 2020-08-31 21:45:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 520 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 86,812 KB
実行使用メモリ 80,420 KB
最終ジャッジ日時 2023-10-14 23:26:47
合計ジャッジ時間 5,030 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,136 KB
testcase_01 AC 79 ms
71,656 KB
testcase_02 AC 115 ms
80,420 KB
testcase_03 AC 91 ms
77,288 KB
testcase_04 AC 93 ms
77,824 KB
testcase_05 AC 94 ms
77,824 KB
testcase_06 AC 100 ms
79,256 KB
testcase_07 AC 96 ms
78,636 KB
testcase_08 AC 98 ms
79,332 KB
testcase_09 AC 95 ms
79,864 KB
testcase_10 AC 76 ms
71,640 KB
testcase_11 AC 91 ms
77,460 KB
testcase_12 AC 99 ms
79,216 KB
testcase_13 AC 95 ms
79,372 KB
testcase_14 AC 95 ms
79,860 KB
testcase_15 AC 100 ms
79,064 KB
testcase_16 AC 95 ms
79,544 KB
testcase_17 AC 101 ms
80,148 KB
testcase_18 AC 105 ms
79,976 KB
testcase_19 AC 100 ms
80,052 KB
testcase_20 AC 99 ms
79,504 KB
testcase_21 AC 90 ms
76,928 KB
testcase_22 AC 99 ms
79,956 KB
testcase_23 AC 100 ms
79,108 KB
testcase_24 AC 100 ms
79,712 KB
testcase_25 AC 95 ms
78,784 KB
testcase_26 AC 103 ms
79,848 KB
testcase_27 AC 99 ms
79,756 KB
testcase_28 AC 96 ms
78,588 KB
testcase_29 AC 102 ms
80,252 KB
testcase_30 AC 100 ms
79,668 KB
testcase_31 AC 101 ms
79,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


K = int(input())

N = int(input())

p = [0] * 2 + [1] * N

for i in range(2, int(N ** 0.5) + 2):
    
    if p[i]:
        
        for j in range(2 * i, N + 1, i):
            
            p[j] = 0
            
P = [i for i in range(K, N + 1) if p[i]]
p = len(P)
for i in range(min(9, p), 0, -1):
    
    for j in range(p - i, -1, -1):
        
        x = [0] * 9
        
        for k in range(j, j + i):
            
            x[P[k] % 9] += 1
        if max(x) == 1:
            print(P[j])
            exit()
0