#Lutece0516. Cake Cutting
Cake Cutting
Migrated from Lutece 516 Cake Cutting
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Today is Simon's birthday, he receives a birthday cake. This cake is a rectangle with its length is and width is , And Simon cut times. Now, he want you to tell him this cake has been divided into how many parts, and the area of each part.
To simplify this problem, we put this cake on a -Dimension rectangular coordinate system, and the edge of cake is parallel to the axes. And the lower left corner is at , the upper right corner is at . Each time of cutting will be parallel to the axis, the starting point and the ending point will be integral points.
P.S. We call a point as a integral point if and only if and are both integers.
Input
First line of the input is a single integer (), indicates there are test cases.
For each test case, the first line is three integers (), () and (), the length and the width of the cake, how many times Simon has cut.
Then lines followed, the line contains four integers (), means the start point and the end point, data will ensure that or . Notice that the starting point or the ending point will not necessary on the cake exactly.
Output
For each case, you should output two lines.
First line,Case #k: n
, where indicates the case number between and , means the cake has been divided into how many parts.
Second line should contain integers , where means the part's area, and for .
Samples
3
2 2 2
0 1 2 1
1 0 1 2
2 2 2
0 1 2 1
1 0 1 1
2 2 1
1 -3 1 1
Case #1: 4
1 1 1 1
Case #2: 3
1 1 2
Case #3: 1
4
Resources
elfness