#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
int buf;
for (int i = 0; i < n; i++) {
cin >> buf;
v[i] = buf * (i+1);
// cout << "v[i] " << v[i] << endl;
}
vector<int> v2(n);
for (int i = n - 1; i >= 1; i--) {
v2[i] = v[i] - v[i-1];
// cout << "v[i] " << v2[i] << endl;
}
v2[0] = v[0];
for (int i = 0; i < n-1; i++) cout << v2[i] << " ";
cout << v2[n-1] << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
4 ms |
256 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |