結果

問題 No.719 Coprime
ユーザー rookzenorookzeno
提出日時 2018-07-28 00:06:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 675 bytes
コンパイル時間 1,123 ms
コンパイル使用メモリ 10,716 KB
実行使用メモリ 29,944 KB
最終ジャッジ日時 2023-09-19 04:14:51
合計ジャッジ時間 12,844 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
29,644 KB
testcase_01 AC 139 ms
29,496 KB
testcase_02 AC 141 ms
29,660 KB
testcase_03 AC 140 ms
29,652 KB
testcase_04 AC 136 ms
29,828 KB
testcase_05 AC 137 ms
29,800 KB
testcase_06 AC 137 ms
29,644 KB
testcase_07 AC 138 ms
29,592 KB
testcase_08 AC 139 ms
29,680 KB
testcase_09 AC 138 ms
29,684 KB
testcase_10 AC 137 ms
29,680 KB
testcase_11 AC 140 ms
29,768 KB
testcase_12 AC 137 ms
29,736 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 138 ms
29,748 KB
testcase_17 AC 139 ms
29,672 KB
testcase_18 AC 140 ms
29,804 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 150 ms
29,680 KB
testcase_23 AC 138 ms
29,808 KB
testcase_24 AC 137 ms
29,760 KB
testcase_25 AC 139 ms
29,692 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 137 ms
29,628 KB
testcase_31 AC 138 ms
29,716 KB
testcase_32 AC 139 ms
29,576 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 138 ms
29,704 KB
testcase_39 AC 138 ms
29,800 KB
testcase_40 AC 139 ms
29,612 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
N = int(input())
def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError("n is int-type.")
    if n < 2:
        raise ValueError("n is more than 2")
    data = [i for i in range(2, n + 1)]
    for d in data:
        data = [x for x in data if (x == d or x % d != 0)]
    return data
so = get_sieve_of_eratosthenes(N)
so = np.array(so)
ans = sum(so)
d = []
for i in range(N):
  a = so[i]
  if a in d:
    break
  if a* a> N:
    break
  b = a+0
  while b *a <=N:
    b =b*a
  c = so[so < N//a]
  try:
    c = c[-1]
  except:
    c =0
  if b-a < a*c-a-c:
    ans += a*c -a-c
    d.append(c)
  else:
    ans += b-a
print(ans)
0