CCF--201809-1卖菜


#include<iostream>
using namespace std;

int main(){

    int n;
    cin >> n;
    int arr[n];
    int arrout[n];
    for(int i = 0; i < n; i++){
        cin >> arr[i];
    }
    for(int i = 0; i < n; i++){
        if(i == 0 && n > 1){
            arrout[i] = (arr[i] + arr[i+1]) / 2;
        }else if(i == n-1 ){
            arrout[i] = (arr[i] + arr[i-1]) / 2;
        }else{
            arrout[i] = (arr[i-1] + arr[i] + arr[i+1])/3;
        }

    }
    for(int i = 0; i < n; i++){
        cout << arrout[i] << " ";
    }
}


posted @ 2020-09-10 14:11  c_y_yuan  阅读(92)  评论(0编辑  收藏  举报