/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 408.0 KiB
#2 Wrong Answer 7ms 576.0 KiB
#3 Wrong Answer 7ms 612.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long

void solve() {
	int arr[3];
	for (int i = 0; i < 3; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + 3);
	int gc = arr[2] - arr[0];
	gc = gcd(arr[2] - arr[0], gc);
	gc = gcd(arr[2] - arr[1], gc);
	if (gc == 0) {
		cout << "0\n";
		return;
	}
	set <int> st;
	for (int i = 0; i < 3; i++) {
		st.insert(arr[i]);
	}
	int ans = 0;
	for (int i : st) {
		ans += (arr[2] - i) / gc;
	}
	cout << ans << "\n";
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int tt = 1;
	cin >> tt;
	while (tt--) {
		solve();
	}
}

Information

Submit By
Type
Submission
Problem
P1061 Bring equality
Contest
Brain Booster #4
Language
C++20 (G++ 13.2.0)
Submit At
2024-07-14 16:32:51
Judged At
2024-11-11 03:24:03
Judged By
Score
10
Total Time
7ms
Peak Memory
612.0 KiB