题解 | #计算糖果#
计算糖果
http://www.nowcoder.com/practice/02d8d42b197646a5bbd0a98785bb3a34
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int a_b,b_c,ab,bc;
cin>>a_b>>b_c>>ab>>bc;
int sum = a_b + ab + bc + b_c;
int a = (a_b + ab)/2;
int b = (b_c + bc)/2;
int c = bc - b;
if(2*a + 2*b != sum || a < 0 || b < 0 || c < 0) cout<<"No";
else cout<<a<<" "<<b<<" "<<c<<endl;
}