Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
//freopen("input.txt","r", stdin);
int t;
cin >> t;
while (t--){
ll x, y;
cin >> x >> y;
int pr = 0;
for ( int i = 1; i <= 100; i++){
if ( i % x && i % y) { cout << i << endl; pr =1; break;}
}
if ( pr == 0) cout<< -1 << endl;
}
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 17:00:50
- Judged At
- 2026-01-06 17:00:50
- Judged By
- Score
- 100
- Total Time
- 4ms
- Peak Memory
- 532.0 KiB