#P1530. [USACO2.4] 分数化小数 Fractions to Decimals
[USACO2.4] 分数化小数 Fractions to Decimals
Description
Write a program that, given a fraction of the form , outputs its decimal representation. If the decimal has a repeating cycle, enclose the cycle in a pair of parentheses.
For example, is written as , is written as , and an integer is written as .
Input Format
The input contains two integers and ().
Output Format
Output the decimal representation computed according to the rules above. If the length of the result exceeds , print characters per line.
45 56
0.803(571428)
Hint
Translated from NOCOW. USACO 2.4
Translated by ChatGPT 5
京公网安备 11011102002149号