SDUT-2749 区域内点的个数

来源:互联网 发布:单片机密码锁程序 编辑:程序博客网 时间:2024/05/21 19:45

区域内点的个数

Time Limit: 1000MS Memory Limit: 65536KB
Submit Statistic Discuss

Problem Description

X晚上睡不着的时候不喜欢玩手机,也不喜欢打游戏,他喜欢数星星。

Input

 多组输入。
每组先输入一个整数N(N <= 10000),接着输入两个点代表矩形的左下点B(x,y)和右上点T(x,y),然后输入N个(X,Y)代表N颗星星。问有多少颗星星在窗子内部,在窗边上的不计。

Output

 输出一个整数,代表有多少颗星星在窗子内部。

Example Input

30 13 41 12 23 3

Example Output

1

Code

#include <stdio.h>  int main()  {      int n,xb,yb,xt,yt,a,b;      while(~scanf("%d",&n))      {          scanf("%d %d",&xb,&yb);          scanf("%d %d",&xt,&yt);          int count=0;          while(n--)          {              scanf("%d %d",&a,&b);              if((a>xb&&a<xt)&&(b>yb&&b<yt))                  count++;          }          printf("%d\n",count);      }      return 0;  }