結果

問題 No.689 E869120 and Constructing Array 3
ユーザー kobaya0514kobaya0514
提出日時 2018-05-19 00:07:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 1,037 ms
コンパイル使用メモリ 10,720 KB
実行使用メモリ 15,952 KB
最終ジャッジ日時 2023-09-10 23:26:17
合計ジャッジ時間 16,163 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 801 ms
15,772 KB
testcase_01 AC 797 ms
15,808 KB
testcase_02 AC 787 ms
15,864 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 799 ms
15,916 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 790 ms
15,728 KB
testcase_11 WA -
testcase_12 AC 804 ms
15,952 KB
testcase_13 AC 830 ms
15,928 KB
testcase_14 AC 797 ms
15,872 KB
testcase_15 AC 773 ms
15,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ansp=[]

for i in range(2,999999):
  if prime[i]:
    cnt=2
    while i*cnt<1000001:
      prime[i*cnt]=False
      cnt+=1
    if i<999999 and prime[i+2]:
      ansp.append(i)
    if len(ansp)>250:
      break

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

if K==0:
  print(1)
  print(2)
else:
  print(len(ans))
  print(*ans)
0