提交时间:2024-01-30 19:37:04
运行 ID: 39144
#include<bits/stdc++.h> using namespace std; int main() { int n; int a; cin>>n; for(int i=0;i<n;i++){ cin>>a; } int n1=0,n2=0,n3=0,n4=0; for(int i=0;i<n;i++){ if(a[i]>=0&&a[i]<=18){ n1++; } if(a[i]>=0&&a[i]<=35){ n2++; } if(a[i]>=0&&a[i]<=60)}{ n3++; } if(a[i]>=0&&a[i]<=61){ n4++; } } cout<<fixed<<seprecision<<(2)<<n1*1.0/n*100<<"%"<<endl; cout<<fixed<<seprecision<<(2)<<n2*1.0/n*100<<"%"<<endl; cout<<fixed<<seprecision<<(2)<<n3*1.0/n*100<<"%"<<endl; cout<<fixed<<seprecision<<(2)<<n4*1.0/n*100<<"%"<<endl; return 0; }