/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 796.0 KiB
#2 Accepted 23ms 836.0 KiB
#3 Accepted 18ms 540.0 KiB
#4 Accepted 21ms 632.0 KiB
#5 Accepted 17ms 560.0 KiB
#6 Accepted 18ms 560.0 KiB
#7 Accepted 18ms 540.0 KiB
#8 Accepted 16ms 540.0 KiB
#9 Accepted 21ms 692.0 KiB
#10 Accepted 18ms 540.0 KiB

Code

/*
 *   Copyright (c) 2024 Emon Thakur
 *   All rights reserved.
 */
#include<bits/stdc++.h>
using namespace std;
//ofstream file("output9.txt");
void solve()
{
    int A,B,C; cin>>A>>B>>C;
    int a,b,c,sum=A+B+C;
    a = min({A,B,C});
    c = max({A,B,C});
    b = sum-a-c;

    int k = __gcd(b-a,c-b);
    //cout<<(c-a)/k<<endl;
    if(k==0) cout<<0<<endl;
    else cout<<(c-a)/k<<endl;
}

int main()
{
    //freopen("input9.txt","r",stdin);
    int t; cin>>t; while(t--) solve();
}

Information

Submit By
Type
Submission
Problem
P1061 Bring equality
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-22 09:53:33
Judged At
2024-05-22 09:53:33
Judged By
Score
100
Total Time
23ms
Peak Memory
836.0 KiB