/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 7ms 532.0 KiB
#3 Accepted 7ms 592.0 KiB
#4 Accepted 6ms 572.0 KiB
#5 Accepted 6ms 556.0 KiB
#6 Accepted 5ms 548.0 KiB
#7 Accepted 5ms 556.0 KiB
#8 Accepted 4ms 324.0 KiB
#9 Accepted 7ms 448.0 KiB
#10 Accepted 7ms 608.0 KiB

Code

// I AM A MUSLIM

#include "bits/stdc++.h"

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

#define fastIO std::ios::sync_with_stdio(0);std::cin.tie(0)
#define ll long long int
#define flush fflush(stdout)
#define bl printf("\n")
#define yn(a, b) printf("%s\n", a >= b ? "Yes":"No")
// #define int ll

using pii = std::pair<int,int>;

const int MOD = 1000000007;
// const int MOD = 998244353;
const int mxN = 500005, inf = INT_MAX;

signed main() {
    // fastIO;
    int testCases=1;
    scanf("%d",&testCases);
    // std::cin>>testCases;
    
    for (int TC = 1; TC <= testCases; TC++) {
        int a[3];
        for (auto &i : a) scanf("%d",&i);
        std::sort(a,a+3);
    
        if (a[0] == a[2]) puts("0");
        else if (a[0] == a[1] || a[1] == a[2]) puts("1");
        else {
            int g = std::__gcd(a[1]-a[0], a[2]-a[1]);
            printf("%d\n", (a[1]-a[0])/g + (a[2]-a[1])/g);
        }
        
    }
    
    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 15:47:53
Judged At
2024-10-03 13:39:11
Judged By
Score
100
Total Time
7ms
Peak Memory
608.0 KiB