【PAT乙级】1053 住房空置率 (20 分)
作者:互联网
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int n,d;
double e;
int a,b;
int main(void)
{
cin>>n>>e>>d;
for(int i=0;i<n;i++)
{
int k,s1,s2; cin>>k;
s1=0,s2=0;
for(int i=0;i<k;i++)
{
double x; cin>>x;
if(x<e) s1++;
else s2++;
}
if(s1>s2&&k>d) b++;
else if(s1>s2) a++;
}
printf("%.1lf%% %.1lf%%\n",a*100.0/n,b*100.0/n);
return 0;
}
标签:1053,PAT,int,s2,s1,cin,%.,20,include 来源: https://blog.csdn.net/qq_46527915/article/details/118638031