提交时间:2019-12-12 19:56:34
运行 ID: 3046
#include<iostream> int main(){ int n,l1=0,l2=0,l3=0,l4=0,a[101]={0}; scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d",&a[i]); if(a[i]<=18){ l1++; }else if(a[i]>=19&&a[i]<=35){ l2++; //0-18、19-35、36-60、61以上(含61) }else if(a[i]>=36&&a[i]<=60){ l3++; }else if(a[i]>=61){ l4++; } } printf("%.2lf%\n",l1*100.0/n); printf("%.2lf%\n",l2*100.0/n); printf("%.2lf%\n",l3*100.0/n); printf("%.2lf%\n",l4*100.0/n); return 0; }