05:年龄与疾病
作者:互联网
#include <stdio.h>
#define MAXN 10000+7
int arr[MAXN];
int main()
{
int i,n,temp;double a=0,b=0,c=0,d=0;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&temp),arr[temp]++;
for(i=0;i<=100;i++)
{
if(i>=0&&i<=18) a+=arr[i];
else if(i>=19&&i<=35) b+=arr[i];
else if(i>=36&&i<=60) c+=arr[i];
else if(i>=61) d+=arr[i];
}
printf("%.2lf%%\n%.2lf%%\n%.2lf%%\n%.2lf%%\n",a*100/n,b*100/n,c*100/n,d*100/n);
return 0;
}
标签:arr,05,int,n%,疾病,&&,2lf%,100,年龄 来源: https://blog.csdn.net/qq_42861250/article/details/90733529