# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1275380 | chanhchuong123 | Prosjek (COCI14_prosjek) | C++20 | 1 ms | 576 KiB |
#include<bits/stdc++.h>
using namespace std;
const bool multiTest = false;
#define task "C"
#define fi first
#define se second
#define MASK(i) (1LL << (i))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define BIT(mask, i) ((mask) >> (i) & 1)
template<typename T1, typename T2> bool minimize(T1 &a, T2 b) {
if (a > b) a = b; else return 0; return 1;
}
template<typename T1, typename T2> bool maximize(T1 &a, T2 b) {
if (a < b) a = b; else return 0; return 1;
}
void process(void) {
int n;
cin >> n;
vector<long long> B(n);
for (long long &x: B) cin >> x;
vector<long long> A(n);
long long pf = B[0];
A[0] = B[0];
for (int i = 1; i < n; ++i) {
A[i] = (i + 1LL) * B[i] - pf;
pf += A[i];
}
for (long long &x: A) cout << x << ' ';
}
int main(void) {
ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
if (fopen(task".inp", "r")) {
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
int nTest = 1; if (multiTest) cin >> nTest;
while (nTest--) {
process();
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |