Hello, I need help understanding the solution for this problem:
using namespace std;
freopen(“promote.in”, “r”, stdin);
freopen(“promote.out”, “w”, stdout);
int bb, ba, sb, sa, gb, ga, pb, pa, ts, tg, tp;
cin >> bb >> ba >> sb >> sa >> gb >> ga >> pb >> pa; tp = pa - pb; tg = ga - gb + pa - pb; ts = sa - sb + ga - gb + pa - pb; cout << ts << "\n" << tg << "\n" << tp << endl; return 0;
Why is it adding the promotions to platinum in the calculation for promotions to gold and the promotions to gold in the calculation for promotions to silver.