/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 4ms 320.0 KiB
#2 Accepted 11ms 764.0 KiB

Code

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

int main(){
    int t;
    cin >> t;
    while(t--){
        int x, y;
        cin >> x >> y;
        if(x < y){
            for(int i = x; i <= 101; i++){
            if(i % x != 0 && i % y != 0 && i < 101){
                cout << i << "\n";
                break;
            }
            if(i == 101){
                cout << "-1" << "\n";
                break;
            }
        }
        }
        else{
            for(int i = y; i <= 101; i++){
            if(i % x != 0 && i % y != 0 && i < 101){
                cout << i << "\n";
                break;
            }
            if(i == 101){
                cout << "-1" << "\n";
                break;
            }
        }
        }
    }
}

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