結果

問題 No.1514 Squared Matching
ユーザー mkawa2mkawa2
提出日時 2024-04-24 00:17:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,974 ms / 4,000 ms
コード長 1,227 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 450,048 KB
最終ジャッジ日時 2024-04-24 00:18:33
合計ジャッジ時間 34,228 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
59,520 KB
testcase_01 AC 1,947 ms
449,408 KB
testcase_02 AC 43 ms
59,520 KB
testcase_03 AC 44 ms
59,264 KB
testcase_04 AC 42 ms
59,648 KB
testcase_05 AC 45 ms
61,696 KB
testcase_06 AC 73 ms
67,456 KB
testcase_07 AC 413 ms
136,576 KB
testcase_08 AC 1,923 ms
435,584 KB
testcase_09 AC 1,695 ms
388,096 KB
testcase_10 AC 1,754 ms
415,488 KB
testcase_11 AC 1,824 ms
430,592 KB
testcase_12 AC 1,905 ms
440,960 KB
testcase_13 AC 1,920 ms
445,952 KB
testcase_14 AC 1,898 ms
448,128 KB
testcase_15 AC 1,970 ms
449,024 KB
testcase_16 AC 1,904 ms
449,536 KB
testcase_17 AC 1,974 ms
449,792 KB
testcase_18 AC 1,919 ms
449,408 KB
testcase_19 AC 1,938 ms
450,048 KB
testcase_20 AC 1,935 ms
449,920 KB
testcase_21 AC 1,918 ms
449,408 KB
testcase_22 AC 417 ms
140,380 KB
testcase_23 AC 807 ms
219,136 KB
testcase_24 AC 1,200 ms
293,504 KB
testcase_25 AC 1,605 ms
371,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = -1-(-1 << 31)
# inf = -1-(-1 << 62)

# md = 10**9+7
md = 998244353

from math import isqrt,floor,sqrt

def solve(n):
    lim=7100
    isprime=[1]*lim
    dp=list(range(n+1))
    for p in range(2,lim):
        if isprime[p]:
            for a in range(p*p,lim,p):isprime[a]=0
            d=p2=p*p
            while d<=n:
                for a in range(d,n+1,d):dp[a]//=p2
                d*=p2
    ans=0
    for a in range(1,n+1):
        ans+=floor(sqrt(n/dp[a]))
        # ans+=isqrt(n//dp[a])

    print(ans)

solve(II())
0