Accepted
Code
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
///ofstream file("output0.txt");
void solve()
{
ll a,b; cin>>a>>b;
ll ans=0;
while(a>0 && b>0)
{
ll mx=max(a,b);
ll mn=min(a,b);
ll x = mx/mn;
ans += x;
a = mn;
b = mx-(x*mn);
}
cout<<ans<<endl;
//file<<ans<<endl;
}
int main(){
int t; cin>>t; while(t--) solve();
//file.close();
}
Information
- Submit By
- Type
- Submission
- Problem
- P1029 Make it zero
- Language
- C++20 (G++ 13.2.0)
- Submit At
- 2024-01-30 19:43:39
- Judged At
- 2024-01-30 19:43:39
- Judged By
- Score
- 100
- Total Time
- 3ms
- Peak Memory
- 592.0 KiB