Golden rectangles
Practice
3.4 (125 votes)
Algorithms
Easy
Searching
Problem
36% Success 35122 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

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

\(1 \le N \le 10^5\)

\(1 \le W, H \le 10^9\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
718 votes
Tags:
ReadyHiringEasy-MediumApprovedSegment tree
Points:20
176 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyOpen
Points:20
10 votes
Tags:
MathLinear SearchAlgorithms