Advertisement
vitormartinotti

Untitled

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