Advertisement
vitormartinotti

Untitled

Apr 30th, 2024
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. int main() {
  4.     int n; scanf("%D", &n);
  5.     int campo[n+2];
  6.     campo[0] = 0;
  7.     campo[n+1] = 0;
  8.     for(int k = 1; k <= n; k++){
  9.         scanf("%d", &campo[k]);
  10.     }
  11.     for(int k = 1; k <= n; k++){
  12.         printf("%d\n", campo[k-1]+campo[k]+campo[k+1]);
  13.     }
  14.     return 0;
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement