其他分享
首页 > 其他分享> > CSP2018-09

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

 

标签:11,CSP201809,CSP2018,int,09,2021,main,卖菜
来源: https://www.cnblogs.com/jasmine-lee/p/15516877.html