/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 320.0 KiB
#2 Wrong Answer 24ms 576.0 KiB
#3 Wrong Answer 24ms 568.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;
    if (a==b or b==c or c==a){
        ans = 1;
    }
    cout<<min(ans,(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:27:56
Judged At
2024-11-11 03:22:58
Judged By
Score
10
Total Time
24ms
Peak Memory
576.0 KiB