/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 30ms 556.0 KiB
#3 Wrong Answer 30ms 556.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;

int minOperations(int a, int b, int c) {
    
    if (a== b&& b== c) return 0;
    else if((a==b && b!=c )|| (b==c && a!=b)|| (a==c && b!=c))return 1;
    else{
        int second=min(max(a,b),c);
        int dif1=second-min(min(a,b),c);
        int dif2=max(max(a,b),c)-second;
        int k=__gcd(dif1, dif2);
        int count=(dif1/k)+(dif2/k);
        return count;
    }
}

int main() {
    int T;
    cin >> T;
    while (T--) {
        int A, B, C;
        cin >> A >> B >> C;
        cout << minOperations(A, B, C) << endl;
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1061 Bring equality
Contest
Brain Booster #4
Language
C++20 (G++ 13.2.0)
Submit At
2024-07-14 17:29:40
Judged At
2024-11-11 03:22:56
Judged By
Score
10
Total Time
30ms
Peak Memory
556.0 KiB