#include <bits/stdc++.h>
using namespace std;
#ifndef HELLO_PEOPLE
#define cerr if(0) cout
#endif
using ll = long long;
using ld = long double;
#define reps(a, b, x, s) \
for (decay<decltype(b)>::type x = a; x < b; x += s)
#define pers(b, a, x, s) \
for (decay<decltype(b)>::type x = b; x >= a; x -= s)
#define rep(a, b, x) reps(a, b, x, 1)
#define per(b, a, x) pers(b, a, x, 1)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define X first
#define Y second
template<class C>
inline int constexpr __size(C c) { return c.size(); }
#define size __size
template<int D, class T>
struct vec : public vector<vec<D - 1, T>> {
template <class... Args>
vec(int n = 0, Args... a) :
vector<vec<D - 1, T>>(n, vec<D - 1, T>(a...)) {}
};
template<typename T>
struct vec<1, T> : public vector<T> {
vec(int n = 0, T const &val = T()) :
vector<T>(n, val) {}
};
// now start
ll const INF = 1e14;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll n;
cin >> n;
vector<ll> a(n);
rep (0, n, i) cin >> a[i];
ll sum = a[0];
vector<ll> b(n);
b[0] = a[0];
rep (1, n, i) {
b[i] = a[i] * (i + 1) - sum;
sum += b[i];
}
rep (0, n, i) cout << b[i] << ' ';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |