Gym 100499I (数学 模拟)

来源:互联网 发布:nasa 太阳能辐射数据 编辑:程序博客网 时间:2024/06/01 20:26
I. Fraction
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

A repeating decimal, also called a recurring decimal, is a number whose decimal representation eventually becomes periodic (i.e., the same sequence of digits repeats indefinitely). The repeating portion of a decimal expansion is conventionally denoted within a pair of brackets so, for example

1 / 6 = 0.16666666... = 0.1(6) = 0.1666(6) = 0.166(66)

Both 0.1(6) or 0.1666(6) or 0.166(66) are correct representation of 1 / 6. Given a recurring decimal representation, your task is to find an irreducible fraction that has that representation.

Input

The first line of input contains the number of tests – T (T ≤ 100). Then T tests follow. Each test is printed in a line as a string whose length does not exceed 15. It is guaranteed to be a meaningful representation of a positive fraction.

Output

For each test, print the result in one line in the format Case #x: a/b

Sample test(s)
input
40.1250.(142857)0.1(6).2
output
Case #1: 1/8Case #2: 1/7Case #3: 1/6Case #4: 1/5
0 0
原创粉丝点击