CSES - Rectangle Cutting
Xem dạng PDF
Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
512M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
Given an ~a \times b~ rectangle, your task is to cut it into squares. On each move you can select a rectangle and cut it into two rectangles in such a way that all side lengths remain integers. What is the minimum possible number of moves?
Input
- The only input line has two integers ~a~ and ~b~.
Output
- Print one integer: the minimum number of moves.
Constraints
- ~1 \le a,b \le 500~
Example Input
3 5
Example Output
3
Bình luận