AcWing 3795. 计算abc
原题链接
简单
作者:
coquetish
,
2024-11-25 15:52:19
,
所有人可见
,
阅读 8
C++ 代码
#include <bits/stdc++.h>
#define sz(a, b) ((a + b - 1) / b)
#define all(_) _.begin(), _.end()
using namespace std;
const int N = 1'00'000;
const int mod = 1'000'000'007;
signed main() {
cin.tie(nullptr) -> ios::sync_with_stdio(false);
int num[5];
for(int i = 1; i <= 4; i ++) cin >> num[i];
sort(num + 1, num + 5);
int abc = num[4];
int a = min({num[4] - num[1], num[4] - num[2], num[4] - num[3]});
int c = max({num[4] - num[1], num[4] - num[2], num[4] - num[3]});
cout << a << " " << abc - a - c<< " " << c;
}