Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
int minOperationsToEqualize(int A, int B, int C) {
vector<int> nums = {A, B, C};
sort(nums.begin(), nums.end());
int median = nums[1];
return (abs(A - median) + abs(B - median) + abs(C - median)) / median;
}
int main() {
int T;
cin >> T;
while (T--) {
int A, B, C;
cin >> A >> B >> C;
cout << minOperationsToEqualize(A, B, C) << endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1061 Bring equality
- Contest
- Brain Booster #4
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-07-14 17:30:28
- Judged At
- 2024-11-11 03:22:55
- Judged By
- Score
- 0
- Total Time
- 30ms
- Peak Memory
- 552.0 KiB