Code
#include<bits/stdc++.h>
#define ll long long
#define cy cout<<"YES"<<endl
#define cn cout<<"NO"<<endl
#define srt sort(v.begin(),v.end())
#define pb push_back
using namespace std;
void rs(){
int x,y;
cin>>x>>y;
int c=-1;
if(x==1 || y==1){
cout<<-1<<endl;
return;
}
for(int i=1;i<100;i++){
if(i%x!=0 && i%y!=0){
c=i;
break;
}
}
cout<<c<<endl;
}
int main(){
int t;
cin>>t;
while(t--){
rs();
}
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 15:35:53
- Judged At
- 2026-01-06 15:35:53
- Judged By
- Score
- 100
- Total Time
- 3ms
- Peak Memory
- 532.0 KiB