fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int a[101] = {0, };
  5. int b[101] = {0, };
  6.  
  7. int main() {
  8. // your code goes here
  9. cin.tie(0);
  10. cout.tie(0);
  11.  
  12. int N;
  13. cin>>N;
  14.  
  15. for(int i=1;i<=N;i++){
  16. cin>>b[i];
  17. a[i] = (b[i] * i) - b[i-1] * (i-1);
  18. }
  19. for(int i=1;i<=N;i++){
  20. cout<<a[i]<<" ";
  21. }
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 5304KB
stdin
5
1 2 2 3 4
stdout
1 3 2 6 8