diff options
Diffstat (limited to 'c/513_empleadoDelAño.cpp')
-rw-r--r-- | c/513_empleadoDelAño.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/c/513_empleadoDelAño.cpp b/c/513_empleadoDelAño.cpp new file mode 100644 index 0000000..6df3fb8 --- /dev/null +++ b/c/513_empleadoDelAño.cpp @@ -0,0 +1,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; + } + } +} |