Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
107078 | 何松羽 | 18患病人数占总患病人数的比例 | C++ | Wrong Answer | 1 MS | 272 KB | 732 | 2025-01-17 12:04:37 |
#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 c1 = 0, c2 = 0, c3 = 0, c4 = 0; for (int i = 0; i < n; i++) { if (a[i] <= 18) { c1++; } if (a[i] >= 19 && a[i] <= 35) { c2++; } if (a[i] >= 36 && a[i] <= 60 ) { c3++; } if (a[i] >= 61) { c4++; } } float b1 = c1 * 1.0 / n * 100.0; float b2 = c1 * 1.0 / n * 100.0; float b3 = c1 * 1.0 / n * 100.0; float b4 = c1 * 2.0 / n * 100.0; printf("%.2f", b1 ); cout << "%" << endl; printf("%.2f", b2 ); cout << "%" << endl; printf("%.2f", b3 ); cout << "%" << endl; printf("%.2f", b4 ); cout << "%" << 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.43% 21.43% 21.43% 42.86%