Code
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
int t;
cin >> t;
while(t-->0){
int x, y;
cin >> x >> y;
bool flag = 0;
for(int i = 1; i <= 100; ++i){
if(i % x != 0 && i % y != 0){
cout << i << '\n';
flag = 1;
break;
}
}
if(!flag)cout << -1 << '\n';
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1235 A. Valid Integer
- Contest
- Happy New Year 2026
- Language
- C++11 (G++ 13.2.0)
- Submit At
- 2026-01-06 14:33:05
- Judged At
- 2026-01-06 14:33:05
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 572.0 KiB