結果
| 問題 |
No.1653 Squarefree
|
| コンテスト | |
| ユーザー |
taiga0629kyopro
|
| 提出日時 | 2021-08-20 23:03:55 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 768 ms / 2,000 ms |
| コード長 | 561 bytes |
| コンパイル時間 | 160 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 243,584 KB |
| 最終ジャッジ日時 | 2024-10-14 08:35:07 |
| 合計ジャッジ時間 | 24,550 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
import sys
input = sys.stdin.readline # 文字列入力はするな!!
from _collections import defaultdict
l,r=map(int,input().split())
dic=defaultdict(lambda:1)
for cnt in range(1,1000000+10):
a=(l/cnt)**0.5
a=int(a)-1
if a<0:a=0
b=(r/cnt)**0.5
b=int(b)+1
for i in range(a,b+1):
if i==1:continue
if l<=cnt*(i**2)<=r:dic[cnt*(i**2)]=0
ans=0
for i in range(2,10**6+10):
x=i**2
k=l//x
while k*x<=r:
if l<=k*x<=r:dic[k*x]=0
k+=1
for i in range(l,r+1):
ans+=dic[i]
print(ans)
taiga0629kyopro