結果

問題 No.1514 Squared Matching
ユーザー yuusanlondonyuusanlondon
提出日時 2021-06-17 07:13:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 936 ms / 4,000 ms
コード長 314 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 467,548 KB
最終ジャッジ日時 2023-08-30 15:54:00
合計ジャッジ時間 16,888 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,320 KB
testcase_01 AC 936 ms
467,168 KB
testcase_02 AC 73 ms
71,256 KB
testcase_03 AC 73 ms
71,284 KB
testcase_04 AC 72 ms
71,188 KB
testcase_05 AC 79 ms
75,720 KB
testcase_06 AC 88 ms
82,132 KB
testcase_07 AC 220 ms
150,824 KB
testcase_08 AC 802 ms
453,256 KB
testcase_09 AC 730 ms
405,752 KB
testcase_10 AC 771 ms
433,152 KB
testcase_11 AC 798 ms
447,880 KB
testcase_12 AC 817 ms
458,676 KB
testcase_13 AC 831 ms
463,372 KB
testcase_14 AC 827 ms
465,460 KB
testcase_15 AC 827 ms
466,444 KB
testcase_16 AC 848 ms
467,116 KB
testcase_17 AC 832 ms
467,292 KB
testcase_18 AC 830 ms
467,548 KB
testcase_19 AC 830 ms
467,360 KB
testcase_20 AC 832 ms
467,044 KB
testcase_21 AC 836 ms
467,192 KB
testcase_22 AC 232 ms
154,320 KB
testcase_23 AC 382 ms
232,460 KB
testcase_24 AC 532 ms
311,264 KB
testcase_25 AC 685 ms
388,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
ans=0
maxsqrt=0
sums=[1]*(n+1)
sums[0]=0
i=2
while i*i<=n:
  j=i*i
  for k in range(j,n+1,j):
    sums[k]=0
  i+=1

currsum=0
for i in range(n+1):
  currsum+=sums[i]
  sums[i]=currsum
while (maxsqrt+1)*(maxsqrt+1)<=n:
  maxsqrt+=1
b=1

while b*b<=n:
  ans+=(2*b-1)*(sums[n//(b*b)])
  b+=1
print(ans)
0