/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 324.0 KiB
#2 Wrong Answer 30ms 584.0 KiB

Code

#include <iostream>
#include <algorithm>
using namespace std;

int gcd(int a, int b) {
    while (b != 0) {
        int temp = b;
        b = a % b;
        a = temp;
    }
    return a;
}


int gcd(int a, int b, int c) {
    return gcd(gcd(a, b), c);
}


int min_operations(int A, int B, int C) {
    int G = gcd(A, B, C);
    int max_value = max(A, max(B, C));
    int min_value = min(A, min(B, C));
    
    int delta = max_value - min_value;
    
    return delta / G;
}

int main() {
    int t;
    cin >> t;
    
    while (t--) {
        int A, B, C;
        cin >> A >> B >> C;
        
        int result = min_operations(A, B, C);
        cout << result << endl;
    }
    
    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 18:21:58
Judged At
2024-11-11 03:22:20
Judged By
Score
0
Total Time
30ms
Peak Memory
584.0 KiB