Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.
If the fractional part is repeating, enclose the repeating part in parentheses.
For example,
- Given numerator = 1, denominator = 2, return "0.5".
- Given numerator = 2, denominator = 1, return "2".
- Given numerator = 2, denominator = 3, return "0.(6)".
{优快云:CODE:635821}

本文介绍了一种将分数转换为字符串格式的方法,特别是当分数的小数部分出现循环时,会在循环部分加上括号进行标记。
159

被折叠的 条评论
为什么被折叠?



