Run ID:107003

提交时间:2025-01-17 10:51:50

#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++; } } int t = c1 + c2 + c3 + c4; float b1 = c1 * 1.0 / t * 100; float d1 = c1 * 1.0 / t * 100; float e1 = c1 * 1.0 / t * 100; float f1 = c1 * 1.0 / t * 100; printf("%.2f", b1); cout << "%" << endl; printf("%.2f", d1); cout << "%" << endl; printf("%.2f", e1); cout << "%" << endl; printf("%.2f", f1); cout << "%" << endl; return 0; }