提出 #32292042
ソースコード 拡げる
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr.append([i, cnt])
if temp!=1:
arr.append([temp, 1])
if arr==[]:
arr.append([n, 1])
return arr
n = int(input())
squares = []
i = 1
while i**2 <= n:
squares.append(i**2)
i += 1
ans = 0
for i in range(1, n+1):
x = i
fact = factorization(i)
odd = 1
for a, cnt in fact:
if cnt % 2 == 1: odd *= a
for j in squares:
if odd * j > n: continue
ans += 1
print(ans)
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Together Square |
| ユーザ | recuraki |
| 言語 | PyPy3 (7.3.0) |
| 得点 | 400 |
| コード長 | 693 Byte |
| 結果 | AC |
| 実行時間 | 1152 ms |
| メモリ | 75156 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 400 / 400 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | example_00.txt, example_01.txt |
| All | example_00.txt, example_01.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| example_00.txt | AC | 68 ms | 62260 KiB |
| example_01.txt | AC | 56 ms | 65288 KiB |
| test_00.txt | AC | 339 ms | 74960 KiB |
| test_01.txt | AC | 130 ms | 74960 KiB |
| test_02.txt | AC | 204 ms | 74916 KiB |
| test_03.txt | AC | 806 ms | 74892 KiB |
| test_04.txt | AC | 106 ms | 74328 KiB |
| test_05.txt | AC | 1130 ms | 74876 KiB |
| test_06.txt | AC | 1139 ms | 74672 KiB |
| test_07.txt | AC | 1146 ms | 74924 KiB |
| test_08.txt | AC | 1145 ms | 74776 KiB |
| test_09.txt | AC | 1152 ms | 74668 KiB |
| test_10.txt | AC | 64 ms | 61876 KiB |
| test_11.txt | AC | 1138 ms | 75156 KiB |