fork download
  1. #include <bits/stdc++.h>
  2. #include <string.h>
  3. using namespace std;
  4. #define ll long long
  5. void solve(){
  6. int n;
  7. cin>>n;int a[n],b;cin>>a[0];
  8. for(int i=1;i<n;i++){cin>>b;a[i]=a[i-1]+b;}
  9. for(auto &p:a){cout<<p<<" ";}cout<<endl;}
  10.  
  11. int main() {
  12. int t;
  13. cin>>t;
  14. while(t--){solve();
  15. }return 0;
  16. }
Success #stdin #stdout 0s 5284KB
stdin
5
5
1 -1 10 1 1
5
-1 -1 -1 -1 -1
2
-1 2
2
7 1
3
1 4 -1
stdout
1 0 10 11 12 
-1 -2 -3 -4 -5 
-1 1 
7 8 
1 5 4