/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Time Exceeded ≥1077ms ≥764.0 KiB
#3 Time Exceeded ≥1090ms ≥532.0 KiB
#4 Time Exceeded ≥1081ms ≥324.0 KiB
#5 Time Exceeded ≥1081ms ≥324.0 KiB
#6 Time Exceeded ≥1089ms ≥320.0 KiB

Code

#include <iostream>
#include<numeric>
#include<algorithm>
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;
    ll ans=0;
    for(ll i=1;i<=a;i++){
        for(ll j=1;j<=b;j++){
            if(gcd(i,j)!=lcm(i,j)){
                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 15:52:24
Judged At
2024-10-03 13:10:02
Judged By
Score
10
Total Time
≥1090ms
Peak Memory
≥764.0 KiB