提交时间:2019-12-14 20:04:56
运行 ID: 3244
#include<iostream> using namespace std; int main() { int n; int f1,f2,f3,f4; int a[105]={0}; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; if(a[i]<=18) f1++; else if(a[i]<=35) f2++; else if(a[i]<=60) f3++; else f4++; } printf("%2.lf %%\n",f1*100.0/n); printf("%2.lf %%\n",f2*100.0/n); printf("%2.lf %%\n",f3*100.0/n); printf("%2.lf %%",f4*100.0/n); return 0; }