結果

問題 No.689 E869120 and Constructing Array 3
ユーザー kobaya0514kobaya0514
提出日時 2018-05-18 23:35:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 466 bytes
コンパイル時間 459 ms
コンパイル使用メモリ 10,984 KB
実行使用メモリ 16,016 KB
最終ジャッジ日時 2023-09-10 23:14:22
合計ジャッジ時間 18,199 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 880 ms
16,012 KB
testcase_01 AC 907 ms
15,940 KB
testcase_02 AC 940 ms
15,980 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 893 ms
15,824 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 910 ms
15,940 KB
testcase_11 WA -
testcase_12 AC 889 ms
15,992 KB
testcase_13 AC 911 ms
15,940 KB
testcase_14 AC 877 ms
15,732 KB
testcase_15 AC 923 ms
15,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

K=int(input())
prime=[True for _ in range(1000001)]
prime[0]=False
prime[1]=False

for i in range(2,1000001):
  if prime[i]:
    cnt=2
    while i*cnt<1000001:
      prime[i*cnt]=False
      cnt+=1

ans2=0
ansp=0
for i in range(1,250):
  for j in range(1,250):
    if i*j==K and i+j<=250:
      ans2=i
      ansp=j
ans=[2]*ans2

for i in range(999999):
  if ansp==0:
    break
  if prime[i] and prime[i+2]:
    ans.append(i)
    ansp-=1

print(len(ans))
print(*ans)
0