Code
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll t ;
cin>>t;
while(t--){
ll x , y;
cin>>x>>y;
ll cnt=0;
for(ll i=2 ; i<=100 ; i++){
if(i%x!=0 && i%y!=0){
cout<<i<<endl;
cnt=1;
break;
}
}
if(cnt==0){
cout<<-1<<endl;
}
}
}
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:53
- Judged At
- 2026-01-06 14:36:53
- Judged By
- Score
- 100
- Total Time
- 4ms
- Peak Memory
- 532.0 KiB