結果

問題 No.2767 Add to Divide
ユーザー srjywrdnprkt
提出日時 2024-04-09 13:45:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 405 bytes
コンパイル時間 2,215 ms
コンパイル使用メモリ 192,824 KB
最終ジャッジ日時 2025-02-20 23:21:27
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample TLE * 1
other -- * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int T;
    cin >> T;

    while(T--){
    	int X=1, A, B;
    	cin >> A >> B;
    	if (B < A*2){
    		cout << -1 << endl;
    		continue;
    	}
    	while(1){
    		if ((B+X) % (A+X) == 0){
    			cout << X << '\n';
    			break;
    		}
    		X++;
    	}
    }

    return 0;
}
0