请问如何输出1/n
“OraOraOraOra...” It’s painful for Jotaro to repeat, also for SHP to recommend JoJo’s Bizarre Adventure series to Quasrain. To prove JoJo is fascinating, SHP wants to do it by proving this problem is not hard for an oceanology doctor or a freshman like you. Jotaro found for a fraction, it’s easy to work out it when the answer has limited digits, which is called finite decimal. However, for an answer like 1/3 and an answer like 33...3 (100 3s) / 100... (100 0s), it’s hard for him to tell them apart. So, he decided to let you design a program to mark the accurate answer. To make the task easy for you to understand and complete, we simplify the problem as follows: for a fraction in the form of 1/x, in which x is a positive integer, output it correctly. If you solve this problem, Quasrain will be willing to watch JoJo, which is exactly what SHP wants.
Input
Multiple test cases. Read to the end of file. Every line contains a positive integer n<=4000. Test cases are no more than 4000.
Output
Output the answer of 1/n in the following format.
For a finite decimal, output it completely without trailing zeros. For an infinite decimal, you don’t need to output it with certain constant number of digits like %.8f, %.10f, ... Please output it in the form of “0.xxxx(xxx...x)”, digits in the brackets standing for the shortest circulating part. See sample for more detail.
Sample Input
1
3
4
9
10
28
Sample Output
1.0
0.(3)
0.25
0.(1)
0.1
0.03(571428)
Hint
Jotaro’s math is poor, but yours is better if you solve this problem.
Submit
Discuss
Time limit : 1 s
Memory limit : 512 mb
Submitted : 227
Accepted : 32
64bit Integer Format : %lld