|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||97||50||44||52.381%|
You were invited to a St. Patrick’s Day party, but you aren’t allowed to leave until you finish your fraction reduction homework. You want to go to the party as soon as possible so you decide to write a program to do your homework for you. Given an improper fraction, calculate its reduced form.
The first line of input is the number of test cases that follow. Each test case is a line containing two integer values. The first integer value will be the numerator n (0 ≤ n ≤ 109), the second integer is the denominator d (0 < d ≤ 109).
For each case output the line “Case x:” where x is the case number, on a single line, followed by a space, and then proper fraction. Each fraction will be of the form “I N/D”, where I is the integer part, N is the numerator of the fractional part, and D is the denominator of the fractional part. If the integer value is equal to 0, only output “N/D”. If both the integer value and the reduced numerator are zero, output “0”. If there is no fractional part, only output “I”.
4 301 100 89 39 50 25 25 50
Case 1: 3 1/100 Case 2: 2 11/39 Case 3: 2 Case 4: 25/50