結果
| 問題 | No.1514 Squared Matching | 
| コンテスト | |
| ユーザー |  yuusanlondon | 
| 提出日時 | 2021-06-17 07:10:53 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                MLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 317 bytes | 
| コンパイル時間 | 317 ms | 
| コンパイル使用メモリ | 82,512 KB | 
| 実行使用メモリ | 840,972 KB | 
| 最終ジャッジ日時 | 2025-01-02 07:36:47 | 
| 合計ジャッジ時間 | 20,350 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 9 MLE * 17 | 
ソースコード
n=int(input())
ans=0
maxsqrt=0
a=[1]*(n+1)
a[0]=0
i=2
while i*i<=n:
  j=i*i
  for k in range(j,n+1,j):
    a[k]=0
  i+=1
sums=[0]*(n+1)
currsum=0
for i in range(n+1):
  currsum+=a[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)
            
            
            
        