提交时间:2019-12-13 20:19:19

运行 ID: 3082

#include<iostream> using namespace std; int main(){ int n; double l1=0,l2=0,l3=0,l4=0; int a[101]={0}; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; if(a[i]<=18) l1++; else if(a[i]<=35) l2++; else if(a[i]<=60) l3++; else l4++; } printf("%.2lf%%\n",l1*100/n); printf("%.2lf%%\n",l2*100/n); printf("%.2lf%%\n",l3*100/n); printf("%.2lf%%",l4*100/n); return 0; }