# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
206142 | aloo123 | Prosjek (COCI14_prosjek) | C++14 | 5 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
using namespace std;
const ll N = 2e5+5;
const ll MOD = 1e9+7;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
ll n;
cin >> n;
ll a[n+1];
for(int i =1;i<=n;i++) cin >> a[i];
ll b[n+1];
b[1] = a[1];
ll sum = b[1];
for(int i =2;i<=n;i++){
// (sum + x)/i = a[i]
// sum + x = a[i] * i
// x = a[i] * i -sum
b[i] = (a[i] * i) - sum;
sum += b[i];
}
for(int i=1;i<=n;i++) cout<<b[i]<<" ";cout<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |