没什么多说的,看清题目要求(多读读判断方法)就能AC
1 #include<iostream> 2 3 using namespace std; 4 5 int main() { 6 int n = 0, d = 0; 7 /*可能空置和空置*/ 8 int empty = 0, mayempty = 0; 9 float e; 10 cin >> n >> e >> d; 11 for (int j = 0; j < n; j++) { 12 int k = 0, half = 0; 13 cin >> k; 14 for (int i = 0; i < k; i++) { 15 float tmp; 16 cin >> tmp; 17 if (tmp * 10 < e * 10)half++; //避免浮点数比大小 18 } 19 if ((half * 2) > k) { //避免浮点数比大小 20 k > d ? empty++ : mayempty++; 21 } 22 } 23 printf("%.1f%% %.1f%%", mayempty * 100.0 / n, empty * 100.0 / n); 24 return 0; 25 }
水水水!