/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 512.0 KiB
#2 Wrong Answer 24ms 584.0 KiB

Code

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

void Solve()
{
    ll a,b,c;
    cin >> a>>b>>c;
    ll ans = 0;
    ll d = __gcd(a,b);
    ll e = __gcd(d,c);

    ll ans1=0, ans2=0, ans3=0;
    ans1 = (abs(a-b)/e)+abs(a-c)/e;
    ans2 = (abs(b-a)/e)+abs(b-c)/e;
    ans3 = (abs(c-a)/e)+abs(c-b)/e;
    cout<<min(ans1, min(ans2, ans3))<<endl;;


    
    
}

int32_t main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t = 1;
    cin >> t;
    while (t--)
        Solve();
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1061 Bring equality
Contest
Brain Booster #4
Language
C++17 (G++ 13.2.0)
Submit At
2024-07-14 17:23:38
Judged At
2024-11-11 03:23:03
Judged By
Score
0
Total Time
24ms
Peak Memory
584.0 KiB