提交时间:2019-12-14 10:24:27
运行 ID: 3154
#include<iostream> using namespace std; int main(){ int a[101]={0},n,a1=0,a2=0,a3=0,a4=0; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; if(a[i]>=0&&a[i]<=18) a1++; if(a[i]>=19&&a[i]<=35) a2++; if(a[i]>=36&&a[i]<=60) a3++; if(a[i]>=61) a4++; } printf("%.2lf%%\n",a1*1.0/n); printf("%.2lf%%\n",a2*1.0/n); printf("%.2lf%%\n",a3*1.0/n); printf("%.2lf%%",a4*1.0/n); return 0; }