HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Functions > problem:


100. 50397 - The Number of Points in a Rectangle

Guest
• Review clarifications (1)

Volume problems

• 061. 50733 - The Highest Average
• 062. 50390 - Total Salary Paid
• 066. 50523 - Total Tax to Pay
• 070. 50534 - Top Trading Company
• 076. 50289 - Monthly Allowance
• 080. 50347 - Selling Oranges
• 090. 50378 - Sum of the given digits
• 095. 50453 - The Cubic Difference
• 100. 50397 - The Number of Po...
• 110. 50409 - Random Password Ge...
• 120. 50684 - Sum of prime numbers...
• 125. 50578 - Mersenne prime
• 130. 50652 - Prime Factorization
• 132. 50474 - Sum of Two Primes
• 135. 50572 - Palindromic Numbers
• 140. 50393 - Palindromic Numbers
• 145. 50586 - Prime Palindromes

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

The Number of Points in a Rectangle

For an experiment, your professor wants to count the number of points in his interest region.

Question:
Write a program that takes the position of a rectangle and coordinates of n points. The program will then count the number of points inside the rectangle.



Note:
  • If a point is on boder, it's count in the interest region.
  • point(1, 1) is in the upper left corner of the picture

Input specification
You will be first given two corners of the rectangle: 4 integers (x and y coordinates of two corners: corner1 and corner2). Then, the number of points (n) is given where 1 ≤ n ≤ 10000. And, next n lines contain two integers x and y representing the coordinates of the points which are between 1 and 10000.

Output specification
Show one integer number: the number of points in the rectangle

Sample Input   
  41 50 51 64
  6
  45 58
  47 15
  46 64
  36 52
  51 57
  24 13
Sample Output   
  3

Explanation
Only the points (45,58), (46,64) and (51,57) are in the interest region.


Для отправки решений необходимо выполнить вход.

www.contester.ru