➤ Problem Link : 1154A. Restoring Three Numbers
✅ C++ Solution :
#include<bits/stdc++.h> using namespace std; #define ll long long int int main() { ll a,b,c,d; ll arr[4]; cin>>arr[0]>>arr[1]>>arr[2]>>arr[3]; sort(arr,arr+4); ll x=arr[3]; ll p1=x-arr[0]; ll p2=arr[1]-p1; ll p3=x-p1-p2; cout<<p1<<" "<<p2<<" "<<p3; }
Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook.
😇Happy Learning!!