Code
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while(t>0){
t--;
int x,y;
cin >> x >> y;
int res=-1;
for(int k=1;k<=100;k++){
if(k%x!=0 && k%y!=0){res=k; break;}
}
cout << res << "\n";
}
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:32:18
- Judged At
- 2026-01-06 14:32:18
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 532.0 KiB