結果
| 問題 |
No.2767 Add to Divide
|
| コンテスト | |
| ユーザー |
june19312
|
| 提出日時 | 2024-05-31 22:59:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 495 bytes |
| コンパイル時間 | 319 ms |
| コンパイル使用メモリ | 81,792 KB |
| 実行使用メモリ | 121,856 KB |
| 最終ジャッジ日時 | 2024-12-21 01:10:33 |
| 合計ジャッジ時間 | 23,348 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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(b//a,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
june19312