結果

問題 No.2767 Add to Divide
ユーザー ニックネームニックネーム
提出日時 2024-05-31 21:38:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 267 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-05-31 21:38:24
合計ジャッジ時間 5,752 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
10,752 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 450 ms
10,752 KB
testcase_04 AC 33 ms
10,752 KB
testcase_05 AC 200 ms
10,880 KB
testcase_06 WA -
testcase_07 AC 215 ms
10,752 KB
testcase_08 AC 373 ms
10,880 KB
testcase_09 WA -
testcase_10 AC 406 ms
10,880 KB
testcase_11 AC 383 ms
10,752 KB
testcase_12 AC 357 ms
10,880 KB
testcase_13 AC 397 ms
10,880 KB
testcase_14 AC 356 ms
10,880 KB
testcase_15 AC 353 ms
10,752 KB
testcase_16 AC 380 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import isqrt
for _ in range(int(input())):
    a,b = map(int,input().split())
    if 2*a>b: print(-1); continue
    c = b-a; d = []
    for i in range(1,isqrt(c)+1):
        if c%i==0: d += [i,c//i]
    for v in sorted(d):
        if v>=a: print(v-a); break
0