/ SeriousOJ /

Record Detail

Accepted


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

Code

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ll t;
    cin >> t;
    while(t--){
        ll n,m;
        cin >> n >> m;
        ll k = 1;
        while(k<=101){
            if((k%n)!=0 && (k%m)!=0){
                break;
            }
            k++;
        }
        if(k>=101)cout << "-1\n";
        else cout << k << endl;
    }
}

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