Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
82112 sh25_chenyj 年龄与疾病 C++ 通过 0 MS 252 KB 433 2026-01-10 12:36:41

Tests(1/1):


#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int ls[4]= {0, 0, 0, 0}; for(int i = 0; i < n; i++){ int a; cin>>a; if(a <= 18){ ls[0] ++; } else if(a <= 35){ ls[1] ++; } else if(a <= 60){ ls[2] ++; } else if(a >= 61){ ls[3] ++; } } for(int i = 0; i<4; i++){ cout << fixed << setprecision(2)<<ls[i]*1.0/n*100<<"%"<<endl; } return 0; }


测评信息: