Accepted
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