Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
2440 张曦元 找找谁的身高超过全班的平均身高 C++ 通过 100 0 MS 260 KB 393 2019-11-25 19:49:52

Tests(1/1):


#include<iostream> #include<cstdio> using namespace std; int h[105]; int main(){ int n; double ave=0; cin>>n; for (int i=1; i<=n; i++){ cin>>h[i]; ave += h[i]; //累加身高 } ave /= n; //平均身高 printf("%.1f\n",ave); for (int i=1,first=0; i<=n; i++) if (h[i]>ave){ if (++first>1) cout<<" "; cout<<i<<":"<<h[i]; } cout<<endl; return 0; }


测评信息: