結果

問題 No.1514 Squared Matching
ユーザー だれだれ
提出日時 2021-05-15 16:14:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,992 ms / 4,000 ms
コード長 597 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 82,424 KB
実行使用メモリ 450,752 KB
最終ジャッジ日時 2024-04-14 06:53:24
合計ジャッジ時間 33,027 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
52,652 KB
testcase_01 AC 1,992 ms
450,432 KB
testcase_02 AC 39 ms
52,468 KB
testcase_03 AC 38 ms
52,244 KB
testcase_04 AC 39 ms
53,508 KB
testcase_05 AC 47 ms
60,796 KB
testcase_06 AC 73 ms
66,664 KB
testcase_07 AC 390 ms
135,588 KB
testcase_08 AC 1,780 ms
435,104 KB
testcase_09 AC 1,563 ms
387,820 KB
testcase_10 AC 1,698 ms
415,364 KB
testcase_11 AC 1,766 ms
430,816 KB
testcase_12 AC 1,803 ms
441,324 KB
testcase_13 AC 1,826 ms
446,436 KB
testcase_14 AC 1,834 ms
447,972 KB
testcase_15 AC 1,836 ms
449,728 KB
testcase_16 AC 1,839 ms
448,960 KB
testcase_17 AC 1,838 ms
449,556 KB
testcase_18 AC 1,840 ms
449,308 KB
testcase_19 AC 1,843 ms
450,752 KB
testcase_20 AC 1,845 ms
450,508 KB
testcase_21 AC 1,836 ms
449,724 KB
testcase_22 AC 402 ms
140,024 KB
testcase_23 AC 765 ms
218,152 KB
testcase_24 AC 1,130 ms
294,484 KB
testcase_25 AC 1,476 ms
371,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import floor, sqrt

def main(n):
    ans = 0
    prime = [True] * (7500)
    x = [i for i in range(n + 1)]
    i = 2
    while i * i <= n:
        if prime[i]:
            w = i * i
            j = w

            while j * j <= n:
                prime[j] = False
                j += i

            j = w
            while j <= n:
                k = j
                while k <= n:
                    x[k] //= w
                    k += j
                j *= w
        i += 1
    for i in range(1, n + 1):
        ans += floor(sqrt(n / x[i]))
    print(ans)

n = int(input())
main(n)
0