ccf201809-1卖菜(满分代码)
作者:互联网
#include<stdio.h>
#define N 1010
int a[N];
int b[N];
int main(){
int n;
scanf("%d", &n);
for(int i=0; i<n; ++i){
scanf("%d", &a[i]);
}
for(int i=1; i<n-1; ++i){
b[i] = (a[i-1]+a[i]+a[i+1])/3;
}
b[0] = (a[0]+a[1])/2;
b[n-1] = (a[n-2]+a[n-1])/2;
for(int i=0; i<n; ++i){
printf("%d ", b[i]);
}
return 0;
}
标签:ccf201809,include,满分,int,卖菜,scanf,main,1010 来源: https://blog.csdn.net/WOSHILURENJI/article/details/104709448