Code
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define nl "\n"
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t;
cin>>t;
while(t--){
int x, y; cin>>x>>y;
int ans = -1;
for (int i = 1; i <= 100; i++) {
if (i%x != 0 && i%y != 0){
ans = i; break;
}
}
cout<<ans<<nl;
}
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:36:12
- Judged At
- 2026-01-06 14:36:13
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 436.0 KiB