> For the complete documentation index, see [llms.txt](https://851958789.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://851958789.gitbook.io/notes/0166_fraction_to_recurring_decimal/slt.md).

# 思路1

用hash map来存放余数。如果同样的数字已经在map中，说明循环。

注意括号要括住整个循环的部分，如4/333 = "0.(012)"。因此，map的值是余数对应的小数在字符串中的索引。这样在插入左括号时，就能知道左括号插在说明地方。

另外为了避免溢出，我们先转成longlong类型
