Little Frank loves mathematics. Every day, he solves some mathematical problems to improve his skill. A few days ago, he found a popular problem about turtles. The problem is as follows. Little Frank...


Computer Engineering Problem


Little Frank loves mathematics. Every day, he solves some mathematical<br>problems to improve his skill.<br>A few days ago, he found a popular problem about turtles. The problem is<br>as follows. Little Frank is given R rectangles, numbered 1 through R. The<br>width and height of the i-th rectangle are Ni and M¡ unit respectively.<br>There is a turtle located on the top-left corner of each rectangle. For each<br>rectangle, count the number of ways the turtle can reach the bottom-right<br>corner, if each turtle can only move right or down 1 unit at any time. The<br>turtle is not allowed to move outside the rectangle, but, of course, the<br>turtle can move on the boundary of the rectangle.<br>In less than one second, this problem was solved for all rectangles. He felt<br>that the problem was too easy. This morning, Little Frank wanted more<br>challenges. Thus, for each rectangle į, he cut and removed a rectangle<br>of A¡ x Bị unit from the top-right corner. See the following figure for detail.<br>Bị<br>Mi<br>He could not solve this new version of the problem easily. Help him count<br>the number of ways each turtle can reach the bottom-right corner using<br>the same rule as before.<br>Develop a C++ code to solve this problem<br>Input:<br>1<br>2211<br>Output:<br>2<br>

Extracted text: Little Frank loves mathematics. Every day, he solves some mathematical problems to improve his skill. A few days ago, he found a popular problem about turtles. The problem is as follows. Little Frank is given R rectangles, numbered 1 through R. The width and height of the i-th rectangle are Ni and M¡ unit respectively. There is a turtle located on the top-left corner of each rectangle. For each rectangle, count the number of ways the turtle can reach the bottom-right corner, if each turtle can only move right or down 1 unit at any time. The turtle is not allowed to move outside the rectangle, but, of course, the turtle can move on the boundary of the rectangle. In less than one second, this problem was solved for all rectangles. He felt that the problem was too easy. This morning, Little Frank wanted more challenges. Thus, for each rectangle į, he cut and removed a rectangle of A¡ x Bị unit from the top-right corner. See the following figure for detail. Bị Mi He could not solve this new version of the problem easily. Help him count the number of ways each turtle can reach the bottom-right corner using the same rule as before. Develop a C++ code to solve this problem Input: 1 2211 Output: 2

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here