結果
問題 |
No.1200 お菓子配り-3
|
ユーザー |
|
提出日時 | 2020-10-01 16:56:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 622 bytes |
コンパイル時間 | 113 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 15,872 KB |
最終ジャッジ日時 | 2024-07-07 01:23:00 |
合計ジャッジ時間 | 23,015 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | WA * 15 TLE * 1 -- * 15 |
ソースコード
def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] Q = int(input()) for _ in range(Q): x, y = map(int, input().split()) div = make_divisors(x) if x == y: print(len(div) + x - 3 + x % 2) continue ans = 0 m = abs(x - y) div2 = make_divisors(m) for i in div2: ans += 1 if i < y and (y - i) % (m // i + 2) == 0 else 0 print(ans)