結果

問題 No.2767 Add to Divide
ユーザー 👑 timitimi
提出日時 2024-06-02 05:19:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 82,160 KB
実行使用メモリ 66,304 KB
最終ジャッジ日時 2024-06-02 05:19:19
合計ジャッジ時間 2,287 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
57,216 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 88 ms
62,336 KB
testcase_04 AC 39 ms
52,864 KB
testcase_05 AC 70 ms
59,648 KB
testcase_06 WA -
testcase_07 AC 74 ms
60,160 KB
testcase_08 AC 89 ms
66,304 KB
testcase_09 WA -
testcase_10 AC 74 ms
59,520 KB
testcase_11 AC 76 ms
60,288 KB
testcase_12 AC 93 ms
60,288 KB
testcase_13 AC 74 ms
60,032 KB
testcase_14 AC 80 ms
60,416 KB
testcase_15 AC 76 ms
60,416 KB
testcase_16 AC 74 ms
59,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#ax,ay,az=map(int, input().split())
#bx,by,bz=map(int, input().split())
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]
  
T=int(input())
for i in range(T):
  a,b=map(int, input().split())
  A=make_divisors(b-a)
  ans=-1
  for aa in A[::-1]:
    if aa>=a:
      ans=aa-a 
  print(ans)
0