P18132 [GeeksforGeeks] Min cut square3303
普及
题目描述

Given two numbers M and N, which represents the length and breadth of a paper, the task is to cut the paper into squares of any size and find the minimum number of squares that can be cut from the paper.
Example 1:
Input: M = 36, N = 30
Output: 5
Explanation:
3 (squares of size 12x12) +
2 (squares of size 18x18)
Example 2:
Input: M = 4, N = 5
Output: 5
Explanation:
1 (squares of size 4x4) +
4 (squares of size 1x1)
Your Task:
You don't need to read input or print anything. Complete the function minCut() which takes M and N as input parameters and returns the integer value
Expected Time Complexity: O(MN(N +M))
Expected Auxiliary Space: O(M*N)
Constraints:
1 ≤ M, N ≤ 10^{2}

输入格式

见题面

输出格式

见题面

样例输入
M = 36, N = 30
样例输出
5