結果
| 問題 |
No.1383 Numbers of Product
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-02-18 15:30:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 901 bytes |
| コンパイル時間 | 242 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 169,464 KB |
| 最終ジャッジ日時 | 2024-11-22 23:28:11 |
| 合計ジャッジ時間 | 17,586 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 50 WA * 1 |
ソースコード
from math import sqrt
n,k,m = map(int,input().split())
from collections import Counter
d = Counter()
for b in range(3,50):
for a in range(1,10**6+1):
x = a
for i in range(1,b):
x *= a + i*k
if x > n: break
if x <= n:
d[x] += 1
else:
break
if a==1: break
def check(x): # a(a+k) = x なる a ある?
v = int((sqrt(float(k)**2 + 4.0*x) - k)/2)
for a in range(max(1,v-2),v+10):
if a >= 1 and a*(a+k)==x: return True
if a*(a+k) > x: return False
return False
ans = 0
for x,v in d.items():
if v == m and not check(x):
ans += 1
elif v == m-1 and check(x):
ans += 1
if m == 1:
v = int((sqrt(float(k)**2 + 4.0*n) - k)/2)
for a in range(max(1,v-2),v+10):
if a*(a+k) > n: break
ans += a-1
for x in d:
if check(x): ans -= 1
print(ans)
convexineq