/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 560.0 KiB
#2 Accepted 4ms 624.0 KiB
#3 Accepted 4ms 612.0 KiB
#4 Accepted 4ms 620.0 KiB
#5 Accepted 4ms 540.0 KiB
#6 Accepted 4ms 540.0 KiB
#7 Accepted 4ms 540.0 KiB
#8 Accepted 4ms 796.0 KiB
#9 Accepted 4ms 796.0 KiB
#10 Accepted 4ms 628.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
const long long M=2e6+10,MOD=1000000007;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin>>t;
    while(t--){
       vector<int>v;
       for(int i=1;i<=3;i++){
        int a;
        cin>>a;
        v.push_back(a);
       }
       sort(v.begin(),v.end());
       int a=v[1]-v[0];
       int b=v[2]-v[1];
       int gd=__gcd(a,b);
       gd=max(1,gd);
       cout<<(a/gd)+(b/gd)<<"\n";

    }
    
   
   return 0;
}
 

Information

Submit By
Type
Submission
Problem
P1061 Bring equality
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-22 10:20:45
Judged At
2024-05-22 10:20:45
Judged By
Score
100
Total Time
4ms
Peak Memory
796.0 KiB