比赛 16暑期热身练习 评测结果 C
题目名称 自动统计机 最终得分 0
用户昵称 wfx 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2016-07-01 11:06:02
显示代码纯文本
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. int main(){
  5. freopen("stats.in","r",stdin);
  6. freopen("stats.out","w",stdout);
  7. int n,t,s=0;
  8. cin>>n;
  9. int a[n];
  10. for(int i=0;i<n;i++)
  11. cin>>a[i];
  12. for(int j=0;j<n;j++)
  13. s=s+a[j];
  14. (double)s/n;
  15. cout<<fixed<<setprecision(6)<<(double)(s)/n<<endl;
  16. for(int q=0;q<n;q++)
  17. for(int w=q;w<n;w++)
  18. if(a[q]<a[w]){t=a[q];a[q]=a[w];a[w]=t;}
  19. if(n%2==1){
  20. cout<<fixed<<setprecision(6)<<a[(n-1)/2]/1.0<<endl; }
  21. if(n%2==0){
  22. cout<<fixed<<setprecision(6)<<(a[n/2]+a[(n-2)/2])/2.0<<endl;}
  23. return 0;}