/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 2ms 532.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define vl vector<ll>
#define vi vector<int>
#define vc vector<char>
#define bug(a) cout<< #a << " : " << a << endl;
#define bug2(a, b) cout << #a << " : " << a << "   " << #b << " : " << b << endl;

void solve() {
    int x,y; cin >> x >> y;
    for(int i=1; i<=100; i++) {
        if((i%x)&&(i%y)) {
            cout << i;
            return;
        }
    }
    cout << -1;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    // solve();
    int t; cin >> t;
    int tc=1;
    while(t--) {
        // cout << "tc #" << tc << " ";
        solve();
        cout << endl;
        tc++;
    }
}

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:35:00
Judged At
2026-01-06 14:35:01
Judged By
Score
100
Total Time
2ms
Peak Memory
532.0 KiB