Time Exceeded
Code
#include <bits/stdc++.h>
using namespace std;
long long sir(long long A, long long B) {
long long op = 0;
while (A != 0 && B != 0) {
if (A > B) {
A = abs(A - B);
} else {
B = abs(B - A);
}
op++;
}
return op;
}
int main() {
int T;
cin >> T;
while (T--) {
long long A, B;
cin >> A >> B;
long long ans = sir(A, B);
cout << ans << endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1029 Make it zero
- Contest
- Brain booster #2
- Language
- C++20 (G++ 13.2.0)
- Submit At
- 2024-03-06 14:23:25
- Judged At
- 2024-11-11 03:41:59
- Judged By
- Score
- 50
- Total Time
- ≥1033ms
- Peak Memory
- ≥544.0 KiB