結果

問題 No.3127 Multiple of Twin Prime
ユーザー june19312
提出日時 2025-04-25 22:57:35
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 505 bytes
コンパイル時間 475 ms
コンパイル使用メモリ 82,656 KB
実行使用メモリ 67,516 KB
最終ジャッジ日時 2025-04-25 22:57:37
合計ジャッジ時間 1,947 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

from more_itertools import *
from bisect import *
sosu = [2]
a = [True]*(10**7+100)
for i in range(3,10**7+100,2):
    if a[i] == False:
        continue
    else:
        sosu.append(i)
        for j in range(2,10**7):
            if i * j > 10**7:
                break
            a[i*j] = False

tmp = [-1]
for i in range(1,len(sosu)):
    if sosu[i]-2 == sosu[i-1]:
        tmp.append(sosu[i]*sosu[i-1])

T = int(input())

for i in range(T):
    N = int(input())
    print(tmp[bisect_right(tmp,N)-1])
0