結果

問題 No.2767 Add to Divide
ユーザー H3PO4
提出日時 2024-05-31 21:38:09
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 309 bytes
コンパイル時間 356 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 28,200 KB
最終ジャッジ日時 2024-12-20 22:48:03
合計ジャッジ時間 31,726 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3 WA * 4 TLE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(A: int, B:int):
    for x in range(10 ** 5):
        if (B + x) % (A + x) == 0:
            return x
    for n in range(10 ** 5, 1, -1):
        if (B - n * A) % (n - 1) == 0:
            return (B - n * A) // (n - 1)

T = int(input())
for _ in range(T):
    print(solve(*map(int, input().split())))
0