Pro.ID10149 TitleFractions to Decimals Title链接http://10.20.2.8/oj/exercise/problem?problem_id=10149 AC29 Submit143 Ratio20.28% 时间&空间限制描述Write a program that will accept a fraction of the form N/D, where N is the numerator and D is the denominator and print the decimal representation. If the decimal representation has a repeating sequence of digits, indicate the sequence by enclosing it in brackets. For example, 1/3 = .33333333...is denoted as 0.(3), and 41/333 = 0.123123123...is denoted as 0.(123). Use xxx.0 to denote an integer. Typical conversions are: 1/3 = 0.(3) 输入A single line with two space separated integers, N and D, 1 ≤ N, D ≤ 100000. 输出Description Write a program that will accept a fraction of the form N/D, where N is the numerator and D is the denominator and print the decimal representation. If the decimal representation has a repeating sequence of digits, indicate the sequence by enclosing it in brackets. For example, 1/3 = .33333333...is denoted as 0.(3), and 41/333 = 0.123123123...is denoted as 0.(123). Use xxx.0 to denote an integer. Typical conversions are: 1/3 = 0.(3) Input A single line with two space separated integers, N and D, 1 ≤ N, D ≤ 100000. Output The decimal expansion, as detailed above. If the expansion exceeds 76 characters in length, print it on multiple lines wi-th 76 characters per line. Sample Input 45 56 Sample Output 0.803(571428) Source 样例输入45 56 样例输出0.803(571428) 作者 |