CSP试题—— 风险人群筛查
2020.10.07
By ljm
C语言满分答案:
#include <stdio.h>
#include <stdlib.h>
int main(int argc
, char *argv
[]) {
int n
,k
,t
,x1
,y1
,x2
,y2
,x
,y
,i
,j
,count
=0,pass
=0,stay
=0,flag1
=0,flag2
=0;
scanf("%d %d %d %d %d %d %d",&n
,&k
,&t
,&x1
,&y1
,&x2
,&y2
);
for(i
=0;i
<n
;i
++){
for(j
=0;j
<t
;j
++){
scanf("%d %d",&x
,&y
);
if((x1
<=x
)&&(x
<=x2
)&&(y1
<=y
)&&(y
<=y2
)){
count
++;
if(count
==k
){
count
=0;
flag1
=1;
}
flag2
=1;
}
else{
count
=0;
continue;
}
}
if(flag1
==1){
stay
++;
flag1
=0;
}
if(flag2
==1){
pass
++;
flag2
=0;
}
}
printf("%d\n%d",pass
,stay
);
return 0;
}
转载请注明原文地址:https://blackberry.8miu.com/read-35705.html