fork download
  1. #include<iostream>
  2. #include<math.h>
  3. #include<iomanip>
  4. #include<string>
  5. #include<algorithm>
  6. #include<map>
  7. #include<stack>
  8. #include<deque>
  9. #include<cstdio>
  10. #include<queue>
  11. #include<fstream>
  12. using namespace std;
  13. int main() {
  14. ifstream cin("sequence.in");
  15. ofstream cout("sequence.out");
  16. int n,a[100000],b[100000],i,j,z,x;
  17. cin>>n;
  18. for(i=1;i<=n;i++) {
  19. cin>>a[i];
  20. }
  21. b[0]=a[1];b[1]=0;b[2]=0;
  22. for(i=2;i<=n;i++) {
  23. b[i+1]=a[i]-b[i]-b[i-1];
  24. }
  25. for(i=0;i<=n+1;i++) {
  26. cout<<b[i]<<" ";
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0s 4128KB
stdin
Standard input is empty
stdout
Standard output is empty