alphacademy-cpp/quito/subtractions.cpp

28 lines
688 B
C++
Raw Normal View History

2023-01-18 21:26:31 +00:00
#include <bits/stdc++.h>
using namespace std;
int main () {
int n;
cin >> n;
int counter = 0;
int elso,masodik;
for (int i =0; i< n;i++) {
cin >> elso >> masodik;
while (elso > 0 || masodik > 0) {
if (elso == 0 || masodik == 0) {
break;
} else if (elso >= masodik) {
elso -= masodik;
counter++;
//cout<<elso<<">"<<masodik<<endl;
} else if (elso <= masodik) {
masodik -= elso;
counter++;
//cout<<elso<<"<"<<masodik<<endl;
}
}
cout<<counter<<endl;
counter = 0;
}
}