Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
106420 | 唐安轩 | 18患病人数占总患病人数的比例 | C++ | Wrong Answer | 1 MS | 280 KB | 713 | 2025-01-16 11:25:58 |
#include<bits/stdc++.h> using namespace std; int main() { int n; double b = 0, c = 0, d = 0, e = 0, a[1000]; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { if (a[i] <= 18) { b++; } else if (a[i] >= 19 && a[i] <= 35) { c++; } else if (a[i] >= 36 && a[i] <= 60) { d++; } else { e++; } } cout<< b / n * 100.0 << '%' << endl; cout<< c / n * 100.0 << '%' << endl; cout<< d / n * 100.0 << '%' << endl; cout<< e / n * 100.0 << '%' << endl; return 0; }
------Input------
14 49 93 26 7 7 90 95 66 43 17 89 75 35 86
------Answer-----
21.43% 14.29% 14.29% 50.00%
------Your output-----
21.4286% 14.2857% 14.2857% 50%