Code
#include <bits/stdc++.h> // All praise is due to Allah alone, and peace and blessings be
using namespace std; // upon him, after whom there is no other Prophet.
int32_t main() {
cin.tie(0)->sync_with_stdio(false);
int32_t Case = 1; cin >> Case;
for (int T = 1; T <= Case; T++) {
int n, m; cin >> n >> m;
int val = -1;
for(int i = 2; i <= 100; i++) {
if(i % n and i % m) {
val = i; break;
}
}
cout << val << '\n';
}
return 0;
}
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:32:01
- Judged At
- 2026-01-06 14:32:01
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 532.0 KiB