Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Rectangle Cutting
Description In the small historical village of Basinia, there is a popular activity in wedding ceremonies called rectangle cutting. During this activity, each close relative of the bride comes and cuts a rectangle in the wedding cake (but does not take a piece). The cake has a rectangular shape. The problem is to count how many pieces are in the cake after rectangle-cutting. For example, in the following figure, the cake size is 3 × 5, and three people have made rectangular cuts in it. As a result, the cake is cut into six pieces. Each rectangular cut is specified by the ( Input The input contains several test cases. Each test has several lines. The first line has two integers Output For each test case, write the number of pieces the cake is cut into. Sample Input 3 5 3 1 1 3 2 4 0 2 3 4 0 5 1 6 6 2 2 0 5 3 3 1 4 2 0 0 Sample Output 6 3 Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator