/ SeriousOJ /

Record Detail

Accepted


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

Code

#include <bits/stdc++.h>
using namespace std;

int main() {
    int test_case;
    cin >> test_case;

    while (test_case--) {
        int x,y;
        cin >> x >>y;
        
        int flag=0;
        for(int i=1;i<=100;i++){
        if(i%x!=0 && i%y!=0){
            cout << i << endl;
            flag=1;
            break;
        }
    }

        if(!flag) cout << "-1" << endl; 
        
    }

    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:01:13
Judged At
2026-01-06 15:01:13
Judged By
Score
100
Total Time
3ms
Peak Memory
764.0 KiB