CSP2018-09

  CSP201809-1 卖菜

 

 

 

 

 1 //
 2 //  main.cpp
 3 //  CSP201809-1 卖菜
 4 //
 5 //  Created by sylvia on 2021/11/6.
 6 //  Copyright © 2021 apple. All rights reserved.
 7 //
 8 
 9 #include <iostream>
10 using namespace std;
11 #define M 1000+4
12 int a[M],b[M];
13 int n;
14 int main(){
15     cin>>n;
16     for (int i=1;i<=n;i++){
17         cin>>a[i];
18     }
19     b[1]=(a[1]+a[2])/2;
20     b[n]=(a[n-1]+a[n])/2;
21     for (int i=2;i<n;i++){
22         b[i]=(a[i-1]+a[i]+a[i+1])/3;
23     }
24     for (int i=1;i<=n;i++){
25         cout<<b[i]<<' ';
26     }
27     return 0;
28 }
View Code

 

posted @ 2021-11-06 14:30  Sylvia_lee  阅读(20)  评论(0编辑  收藏  举报