Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
151968 何兴驰 18患病人数占总患病人数的比例 C++ Accepted 1 MS 272 KB 600 2026-04-19 12:37:42

Tests(10/10):


Code:

#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 c=0,d=0,e=0,f=0; for (int j=0;j<n;j++) { if (a[j]<=18) { c++; } if (a[j]>=19 && a[j]<=35) { d++; } if (a[j]>=36 && a[j]<=60) { e++; } if (a[j]>=61 ) { f++; } } printf("%.2f", c * 100.0 / n); cout << "%"; cout << endl; printf("%.2f", d * 100.0 / n); cout << "%"; cout << endl; printf("%.2f", e * 100.0 / n); cout << "%"; cout << endl; printf("%.2f", f * 100.0 / n); cout << "%"; return 0; }