Golden rectangles

3.4

125 votes
Algorithms, Easy, Searching
Problem

You have N rectangles. A rectangle is golden if the ratio of its sides is in between [1.6,1.7], both inclusive. Your task is to find the number of golden rectangles.

Input format

  • First line: Integer N denoting the number of rectangles
  • Each of the N following lines: Two integers W,H denoting the width and height of a rectangle

Output format

  • Print the answer in a single line.

Constraints

1N105

1W,H109

Sample Input
5
10 1
165 100
180 100
170 100
160 100

Sample Output
3
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

There are three golden rectangles: (165, 100), (170, 100), (160, 100).

Editor Image

?