Cut the Sheet
Practice
3.3 (3 votes)
Math
C++
Basic math
Observation
Problem
39% Success 501 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Bob is initially given one sheet of width \(W\) and height \(H\). He wants to make at least \(N\) pieces from the sheet. He can cut any sheet into two equal pieces along any side of the rectangular sheet such that the value of width and height of the resultant pieces always remain an integer. For example, If the sheet has \(2X2\) dimensions, he can make two pieces of \(1X2\) dimensions or two of \(2X1\) dimensions.

Print \(Yes\) if Bob is able to make at least \(N\) pieces or \(No\) otherwise.

Input Format:

  • The first line contains an integer \(T\), which denotes the number of test cases.
  • The first line of each test case contains three integers \(W\), \(H\), and \(N\) denoting the dimensions of the sheet and the least number of pieces Bob has to make.

Output Format:

For each test case, print \(Yes\) if Bob is able to make at least \(N\) pieces or \(No\) otherwise.

Constraints:

\(1 \leq T \leq 10^5 \\ 1 \leq W,H \leq 10^9 \\ 1 \leq N \leq 10^{18}\)

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:10
5 votes
Tags:
Math BasicAlgorithmsBasic MathMath
Points:10
80 votes
Tags:
Basic ProgrammingBasic MathMath BasicMath
Points:10
16 votes
Tags:
Very-EasyVery Easy