結果
| 問題 | No.2767 Add to Divide |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-31 22:24:15 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 415 bytes |
| 記録 | |
| コンパイル時間 | 1,273 ms |
| コンパイル使用メモリ | 209,684 KB |
| 実行使用メモリ | 12,028 KB |
| 最終ジャッジ日時 | 2026-07-04 19:54:17 |
| 合計ジャッジ時間 | 2,342 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 1 WA * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main () {
int T;
cin >> T;
while (T--) {
int a, b;
cin >> a >> b;
if (b % a == 0) {
puts("0");
} else {
int d = b - a;
int p = -1;
for (int x = 2; x * x <= d; x ++) {
if (d % x == 0) {
if (a <= x) {
p = x;
break;
}
if (a <= d / x) {
p = d / x;
}
}
}
cout << max(-1, p - a) << endl;
}
}
}