本站作为LDUOnlineJudge的测试版本进行演示,官方网站请访问http://icpc.ldu.edu.cn
[Hidden]

1212. C. Fold the Paper Nicely


Description

Dr. Orooji has a daily calendar (365 pages) on his desk. Every morning, he tears off one page
and, as he is reading the notes on the next page, he folds (out of habit) the sheet in his hand. Dr.
O noticed that he always folds the sheet (a rectangular paper) along the longer side, e.g., if one
side is 80 and the other side is 60, he would fold along 80; this will make the paper of size 40
and 60; if he folds it again, he would fold along 60 since that’s the longer side now.
The Problem:
Given a rectangular piece of paper and how many times Dr. O folds it, you are to determine the
final sizes. When folding a side with an odd length, the fraction is ignored after folding, e.g., if a
side is 7, it will become 3 after folding.

Input

The first input line contains a positive integer, n, indicating the number of data sets. The sets are
on the following n input lines, one set per line. Each set contains three positive integers (each ≤
10000), the first two providing the rectangle sides and the third providing the number of folds.

Output

At the beginning of each test case, output “Data set: v” where v is the input values. Then,
on the next output line, print the final values for the rectangle (larger side of the final values
first). Leave a blank line after the output for each test case. Follow the format illustrated in
Sample Output.

Samples

Input Copy
3
60 51 4
3 2 50
3 2 1
Output
Data set: 60 51 4
15 12

Data set: 3 2 50
0 0

Data set: 3 2 1
2 1

Source

UCF2012
Problem Information

Time Limit: 1000MS (C/C++,Others×2)
Memory Limit: 128MB (C/C++,Others×2)
Special Judge: No
AC/Submit: 1 / 1
Tags:
Contests involved

1025. UCF 2012
My history solutions

You didn't submit any solution!
Submit your solution

Login Register