Advertisement
vitormartinotti

Untitled

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