#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);

    int V[n], minas[n];
    for(int i=0; i<n; i++){
       scanf("%d", &V[i]);
        minas[i]=0;
    }
    if(n>1){
        minas[0] = V[0] + V[1];
        minas[n-1] = V[n-2]+V[n-1];
    }
    else{
        minas[0] = V[0];
    }
    for(int i=1; i<n-1; i++){
       minas[i] = V[i-1]+V[i]+V[i+1];
    }
    for(int i=0; i<n; i++){
        printf("%d\n", minas[i]);
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: