aboutsummaryrefslogtreecommitdiff
path: root/c/513_empleadoDelAño.cpp
blob: 6df3fb86196ca5ae183c6dedcb84ae8e7af7733a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

using namespace std;

// mean: Ex / n = m; a/n + b/n + x/n = m; (a+b)/n = m - x/n; x = -n((a+b)/n-m)
int main() {
	int days, day, total, mean;
	while (cin >> days) {
		total = 0;
		for (int n = 1; n <= days; n++) {
			cin >> mean;
			day = n*mean-total;
			total += day;
			if (n != days)
				cout << day << " ";
			else
				cout << day << endl;
		}
	}
}