Code
#include<bits/stdc++.h>
using namespace std;
/*
* @author abhishek
*
*/
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int tt;
cin>>tt;
while(tt--) {
int x, y;
cin>>x>>y;
int ans=-1;
int maxi= max(x, y);
int mini= min(x, y);
for(int k= maxi;k<=100;k++) {
if(k%mini !=0 && k%maxi!=0) {
ans= k;
break;
}
}
cout<<ans<<endl;
}
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:46:41
- Judged At
- 2026-01-06 14:46:41
- Judged By
- Score
- 1
- Total Time
- 3ms
- Peak Memory
- 532.0 KiB