提交时间:2023-12-02 19:31:49
运行 ID: 32758
#include<iostream> using namespace std; int main() { int n; int n1=0,n2=0,n3=0,n4=0; int a[105]; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; if(a[i]<=18) n1++; else if(a[i]<=35) n2++; else if(a[i]<=60) n3++; else n4++; } printf("%.2f%\n",n1*1.0/n*100); printf("%.2f%\n",n2*1.0/n*100); printf("%.2f%\n",n3*1.0/n*100); printf("%.2f%\n",n4 *1.0/n*100); return 0; }