結果

問題 No.719 Coprime
ユーザー rookzenorookzeno
提出日時 2018-07-27 23:59:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 10,968 KB
実行使用メモリ 29,988 KB
最終ジャッジ日時 2023-09-19 03:59:22
合計ジャッジ時間 13,830 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
29,536 KB
testcase_01 AC 142 ms
29,512 KB
testcase_02 AC 145 ms
29,780 KB
testcase_03 AC 142 ms
29,748 KB
testcase_04 AC 138 ms
29,772 KB
testcase_05 AC 137 ms
29,784 KB
testcase_06 AC 140 ms
29,756 KB
testcase_07 AC 141 ms
29,848 KB
testcase_08 AC 139 ms
29,636 KB
testcase_09 AC 138 ms
29,796 KB
testcase_10 AC 140 ms
29,640 KB
testcase_11 AC 141 ms
29,684 KB
testcase_12 AC 141 ms
29,708 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 140 ms
29,780 KB
testcase_17 AC 141 ms
29,848 KB
testcase_18 AC 146 ms
29,716 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 140 ms
29,776 KB
testcase_23 AC 138 ms
29,792 KB
testcase_24 AC 142 ms
29,704 KB
testcase_25 AC 138 ms
29,756 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 138 ms
29,728 KB
testcase_31 AC 139 ms
29,756 KB
testcase_32 AC 138 ms
29,800 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 141 ms
29,696 KB
testcase_39 AC 140 ms
29,612 KB
testcase_40 AC 137 ms
29,808 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)
for i in range(N):
  a = so[i]
  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
  else:
    ans += b-a
print(ans)
0