| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 106559 | 顾梦琪 | 18患病人数占总患病人数的比例 | C++ | Wrong Answer | 1 MS | 272 KB | 709 | 2025-01-16 12:50:33 |
#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] >= 0 && 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 s=c1+c2+c3+c4; float b1=c1/s*100; float b2=c2/s*100; float b3=c3/s*100; float b4=c4/s*100; printf("%.2f", b1); cout << "%" << endl; printf("%.2f", b2); cout << "%" << endl; printf("%.2f", b3); cout << "%" << endl; printf("%.2f", b4); cout << "%" << endl; return 0; }
------Input------
54 52 76 71 69 64 8 41 35 93 55 79 33 24 54 25 93 75 73 48 56 97 66 85 49 79 83 99 70 62 36 53 49 40 44 49 67 51 71 23 50 68 36 10 61 28 31 52 88 45 6 9 47 74 8
------Answer-----
9.26% 12.96% 35.19% 42.59%
------Your output-----
9.43% 13.21% 35.85% 41.51%