結果
問題 |
No.2767 Add to Divide
|
ユーザー |
![]() |
提出日時 | 2024-05-31 23:04:07 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 508 bytes |
コンパイル時間 | 491 ms |
コンパイル使用メモリ | 82,100 KB |
実行使用メモリ | 123,828 KB |
最終ジャッジ日時 | 2024-12-21 01:19:03 |
合計ジャッジ時間 | 23,090 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 TLE * 7 |
ソースコード
T = int(input()) #4394 993298361 for j in range(T): a,b = map(int,input().split()) if b%a == 0: print(0) continue elif b//a < 2: print(-1) continue for k in range(min(b//a,10000000),1,-1): ok,ng = 0,1000000000 while abs(ok-ng) > 1: mid = abs((ok+ng)//2) if (b+mid)//(a+mid) < k: ng = mid else: ok = mid if (b+ok)%(a+ok) == 0: print(ok) break