/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 3ms 332.0 KiB
#2 Accepted 2ms 332.0 KiB
#3 Accepted 9ms 616.0 KiB
#4 Accepted 45ms 1.43 MiB
#5 Accepted 62ms 2.164 MiB
#6 Accepted 52ms 2.27 MiB

Code

#include <iostream>
#include<numeric>
#include<algorithm>
#include<deque>
using namespace std;

#define ll long long int
#define ld long double
#define endl '\n'
#define MIR183_Mac ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define yes cout << "YES" << endl
#define no cout << "NO" << endl



void solve() {
    // Your code here
    ll a,b;
    cin>>a>>b;


    // ll x=gcd(a,b);
    // ll y=lcm(a,b);
    // cout<<x<<" "<<y<<endl;
    // deque<deque<ll>>v(a+1,deque<ll>(b+1,0));
    ll ans=0;
    // for(ll i=1;i<=a;i++){
    //     for(ll j=1;j<=b;j++){
    //         // ll gcdij=gcd(i,j);
    //         // ll gcdij=v[i][j];
    //         // ll lcmij=(i*j)/gcdij;
    //         if(i!=j) ans++;
    //     }
    // }
    ll tp=a*b;
    ll same=min(a,b);
    ll diff=tp-same;
    ans=diff;
    // for(ll i=1;i<=a;i++){
    //     for(ll j=1;j<=b;j++){
    //         ll gcdij=v[i][j];
    //         ll lcmij=(i*j)/gcdij;
    //         if(gcdij!=lcmij) ans++;
    //     }
    // }
    cout<<ans<<endl;
    // ans=0;

}

signed main() {
    MIR183_Mac;
    // Always use ll, int may give TLE
    ll tt;
    // tt=1;
    cin >> tt;
    while (tt--) {
        solve();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1075 GCD not equal LCM
Contest
Brain Booster #5
Language
C++20 (G++ 13.2.0)
Submit At
2024-09-05 16:11:38
Judged At
2024-11-11 03:01:25
Judged By
Score
100
Total Time
62ms
Peak Memory
2.27 MiB