Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
104755 | 石水生 | 18患病人数占总患病人数的比例 | C++ | Accepted | 1 MS | 272 KB | 446 | 2025-01-10 11:32:07 |
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int a[n]; for(int i=0;i<n;i++){ cin>>a[i]; } int type1=0,type2=0,type3=0,type4=0; for(int i=0;i<n;i++){ if(a[i]>=0&&a[i]<=18) type1++; else if(a[i]>=19&&a[i]<=35) type2++; else if(a[i]>=36&&a[i]<=60) type3++; else if(a[i]>=61) type4++; } printf("%.2f%%\n%.2f%%\n%.2f%%\n%.2f%%",type1*100.0/n,type2*100.0/n,type3*100.0/n,type4*100.0/n); }