結果
問題 | No.1383 Numbers of Product |
ユーザー |
![]() |
提出日時 | 2021-02-09 18:26:13 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,015 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 243,852 KB |
最終ジャッジ日時 | 2024-09-14 02:42:37 |
合計ジャッジ時間 | 22,821 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 50 WA * 1 |
ソースコード
from math import sqrtn,k,m = map(int,input().split())fk = float(k)def val(a,s):v = float(a)for i in range(1,s):v *= a+i*fkif v > 2e18: return 2000000000000000000w = afor i in range(1,s):w *= a+i*kreturn wfrom collections import Counterd = Counter()for s in range(3,100):if val(1,s) > n: breakfor a in range(1,10**6+1):x = val(a,s)if x <= n: d[x] += 1else: breakdef 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 Trueif a*(a+k) > x: return Falsereturn Falseans = 0for x,v in d.items():if v == m and not check(x):ans += 1elif v == m-1 and check(x):ans += 1if m == 1:v = int((sqrt(float(k)**2 + 4.0*n) - k)/2)for a in range(max(1,v-3),v+5):if a*(a+k) > n: breakans += a-1for x in d:if check(x): ans -= 1print(ans)