結果
| 問題 |
No.1200 お菓子配り-3
|
| コンテスト | |
| ユーザー |
👑 tatyam
|
| 提出日時 | 2020-07-19 22:03:52 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 609 bytes |
| コンパイル時間 | 329 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 21,504 KB |
| 最終ジャッジ日時 | 2024-11-14 14:21:32 |
| 合計ジャッジ時間 | 65,881 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 TLE * 11 |
ソースコード
def divisor(x):
ans = []
for i in range(1, int(x**0.5) + 1):
if x % i == 0:
ans.append(i)
if i * i != x:
ans.append(x / i)
return ans
s = int(input())
assert(1 <= s <= 10_000)
for _ in range(s):
x, y = map(int, input().split())
assert(1 <= x <= 500_000_000)
assert(1 <= y <= 500_000_000)
if x == y:
print(len(divisor(x)) + x + x % 2 - 3)
continue
ans = 0
if x < y:
x, y = y, x
n = x - y
for d in divisor(n):
a = n // d + 1
ans += y > d and not (y - d) % (a + 1)
print(ans)
tatyam