记录编号 | 275330 | 评测结果 | AAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | 126.[USACO Mar08] 自动统计机 | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 0.003 s | ||
提交时间 | 2016-07-02 09:11:18 | 内存使用 | 0.32 MiB | ||
#include <fstream> #include <algorithm> #include <iomanip> using namespace std; ifstream fin("stats.in"); ofstream fout("stats.out"); int n; double x[500]; long double add=0; int main() { fin>>n; for(int i=0;i<n;i++) { fin>>x[i]; add+=x[i]; } fout<<setiosflags(ios::fixed)<<setprecision(6)<<add/n<<endl; sort(x,x+n); if(n%2==0) { long double out=(x[n/2-1]+x[n/2])/2; fout<<out<<endl; } else { long double out=x[n/2]; fout<<out<<endl; } fin.close(); fout.close(); return 0; }