Codeforces 1154 A. Restoring Three Numbers Solution
Solve in C++:
//AH Tonmoy
//Department of CSE ,Islamic University
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[4],ar,b,c,i;
while(cin>>a[0]>>a[1]>>a[2]>>a[3])
{
sort(a,a+4);
ar=a[3]-a[0];
b=a[3]-a[2];
c=a[3]-a[1];
cout<<ar<<" "<<b<<" "<<c<<endl;
}
}
//AH Tonmoy
//Department of CSE ,Islamic University
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[4],ar,b,c,i;
while(cin>>a[0]>>a[1]>>a[2]>>a[3])
{
sort(a,a+4);
ar=a[3]-a[0];
b=a[3]-a[2];
c=a[3]-a[1];
cout<<ar<<" "<<b<<" "<<c<<endl;
}
}
No comments