参考:https://blog.csdn.net/weixin_45493055/article/details/108956399
注意:1、连续的k
2、输出格式
#include<bits/stdc++.h>
using namespace std;
#define _for(i,a,b) for(int i=a;i<b;i++)
int main()
{
int n,k,t,x1,x2,y1,y2;
//freopen("in.txt","r",stdin); //输入重定向,输入数据将从in.txt文件中读取
cin>>n>>k>>t>>x1>>y1>>x2>>y2;
int count=0,pass=0,stay=0,f1=0,f2=0;
_for(i,0,n)
{
_for(j,0,t)
{
int x,y;
cin>>x>>y;
if(x1<=x && x<=x2 && y1<=y && y<=y2)
{
count++;
f1=1;
if(count==k)
{
f2=1;
}
}
else
{
count=0;
}
}
pass+=f1;
stay+=f2;
f1=f2=count=0;
}
cout<<pass<<endl<<stay;
//fclose(stdin);
return 0;
}