Rectangles to squares
Practice
3.8 (5 votes)
Problem
94% Success 5061 Attempts 20 Points 5s Time Limit 256MB Memory 1024 KB Max Code
You are given a rectangle of size \(m \times n\). You have to figure out if it is possible to divide the provided rectangle into equal-sized squares other than \(1 \times 1\).
Print Yes if it is possible to perform the mentioned task. Otherwise, print No.
Input format
First line: Two space-separated integers \(m\) and \(n\) denoting the size of the rectangle
Output format
Print only one line containing Yes or No.
Constraints
\(1 \leq m, 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
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:50
10 votes
Tags:
AlgorithmsDynamic Programming2D dynamic programmingC++
Points:30
22 votes
Tags:
AlgorithmsDynamic ProgrammingEasyString ManipulationTwo dimensional
Points:10
1 votes
Tags:
Prime FactorizationVery-EasyVery-Easy
Editorial
Login to unlock the editorial