a_study_xxs @ 2023-04-03 18:44:02
#include<iostream>
using namespace std;
int n , a[1000005] ;
int main(){
cin >> n ;
for(int i = 1 ; i <= n ; i ++ ) {
cin >> a[i] ;/*
if(i % 2 == 1){
int sum = 0 ;
for(int j = 1; j <= i ; j ++ ){
sum += a[j] ;
}
cout << sum / i << endl ;
}*/
if(i <= (n + 1) / 2){
int ans = 0;
for(int j = 1 ; j <= 2 * i - 1 ; j ++ ){
ans += a[j] ;
}
cout << ans / (2 * (i - 1)) << endl ;
}
}
return 0;
}
by fzy1026 @ 2023-04-03 18:48:49
请稍微解释一下自己的思路
by chaynflow @ 2023-04-03 18:58:40
中位数是排序后在中间的数,不是总和除以个数。
by chaynflow @ 2023-04-03 18:59:55
你这定义理解就错了。。。
by chaynflow @ 2023-04-03 19:00:13
@mzh98K
by a_study_xxs @ 2023-04-03 20:48:35
@chy2011 ok