Hello, I need help understanding the solution for this problem:
Problem:
http://www.usaco.org/index.php?page=viewproblem2&cpid=591
Solution:
#include <bits/stdc++.h>
using namespace std;
int main()
{
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.