Code
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define el '\n'
void run_case(int tc) {
int x, y;
cin >> x >> y;
for (int i = 1; i <= 100; i++) {
if ((i%x) && (i%y)) {
cout << i << el;
return;
}
}
cout << "-1\n";
}
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int _t = 1;
cin >> _t;
for (int i = 1; i <= _t; i++) {
run_case(i);
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1235 A. Valid Integer
- Contest
- Happy New Year 2026
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2026-01-06 14:58:05
- Judged At
- 2026-01-06 14:58:05
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 532.0 KiB