Skip to content

repeatingdecimal

bradendubois edited this page Jun 9, 2021 · 6 revisions

Repeating Decimal

ID: repeatingdecimal

Difficulty: 3.4

CPU Time: 2 seconds

Memory: 1024 MB

Solution

For this, one can just implement basic long division. Since a < b, output "0." to start, and then, looping c times: if a < b, a *= 10; output a / b, and mod b from a.

Clone this wiki locally