CSP试题—— 风险人群筛查

    科技2024-12-29  17

    CSP试题—— 风险人群筛查

    2020.10.07

    By ljm

    C语言满分答案:

    #include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 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; }
    Processed: 0.010, SQL: 8