【PAT】B1053 住房空置率(20 分)
#include<cstdio>
#include<string.h>
#include<algorithm>
using namespace std;
int main(){
double e;int N,D;
scanf("%d %lf %d",&N,&e,&D);
int kong=0,may=0,zong=0;
int tianshu;
while(scanf("%d",&tianshu)!=EOF){
zong++;
int diyu=0;
double temp;
for(int i=0;i<tianshu;i++){
scanf("%lf",&temp);
if(temp<e) diyu++;
}
if(diyu>(tianshu/2)){
if(tianshu>D) kong++;
else may++;
}
}
printf("%.1f%% %.1f%%",may/(double)zong*100,kong/(double)zong*100);
return 0;
}
大佬忽略,见笑。