結果
| 問題 |
No.1383 Numbers of Product
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-02-09 18:02:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 649 bytes |
| コンパイル時間 | 231 ms |
| コンパイル使用メモリ | 82,156 KB |
| 実行使用メモリ | 223,188 KB |
| 最終ジャッジ日時 | 2024-07-07 00:04:57 |
| 合計ジャッジ時間 | 10,819 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 WA * 34 |
ソースコード
from math import sqrt
n,k,m = map(int,input().split())
def is_small(a):
if float(a)*(a+k)*(a+2*k) > 2e18: return False
else: return a*(a+k)*(a+2*k) <= n
from collections import Counter
d = Counter()
for a in range(1,10**6+1):
if is_small(a): d[a*(a+k)*(a+2*k)] += 1
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-3),v+5):
if a >= 1 and a*(a+k)==x: return True
if a*(a+k) > x: return False
return False
ans = 0
for k,v in d.items():
if v == m and not check(k):
ans += 1
elif v == m-1 and check(k):
ans += 1
print(ans)
convexineq