#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define file freopen("in.txt", "r", stdin);
#define pii pair<int,int>
#define pb push_back
#define all(v) v.begin(), v.end()
#define keepunique(v) (v).erase(unique(all(v)),v.end())
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);
const int maxn = 105;
ll arr[maxn], ans[maxn];
int n;
void solve(){
ans[1] = arr[1];
ll sum = arr[1];
for(int i=2; i<=n; i++){
ans[i] = (i*arr[i])-sum;
sum += ans[i];
}
for(int i=1; i<=n; i++)cout<<ans[i]<<" ";
}
int main(){
//file
fastread
cin>>n;
for(int i=1; i<=n; i++)cin>>arr[i];
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
572 KB |
Output is correct |
3 |
Correct |
2 ms |
660 KB |
Output is correct |
4 |
Correct |
2 ms |
660 KB |
Output is correct |
5 |
Correct |
2 ms |
660 KB |
Output is correct |
6 |
Correct |
2 ms |
660 KB |
Output is correct |
7 |
Correct |
2 ms |
828 KB |
Output is correct |
8 |
Correct |
2 ms |
828 KB |
Output is correct |
9 |
Correct |
2 ms |
828 KB |
Output is correct |
10 |
Correct |
2 ms |
828 KB |
Output is correct |