➤ Problem Link : 557A. Ilya and Diplomas
✅ C++ Solution :
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; pair<int,int> a,b,c; cin>>a.first>>a.second; cin>>b.first>>b.second; cin>>c.first>>c.second; int s=b.first+c.first; int a1,a2,a3; if(a.second < n-s) a1=a.second; else a1=n-s; n-=a1; s=c.first; if(b.second < n-s) a2=b.second; else a2=n-s; n-=a2; a3=n; cout<<a1<<" "<<a2<<" "<<a3<<endl; }
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!!