Min cut Square
Submissions: 3615   Accuracy:

23.15%

  Difficulty: Medium   Marks: 4

Given a paper of size A x B. Task is to cut the paper into squares of any size. Find the minimum number of squares that can be cut from the paper.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains two integer A and B denoting the two size of the paper.

Output:
Print the minimum number of squares that can be cut from the paper.

Constraints:
1<=T<=10^5
1<=A<=10^5
1<=B<=10^5

Example:
Input:

2
13 29
30 35

Output:
9
5

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil
Author: Ayush Govil 1


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.