CT100

Digit Cancelling Fractions

MediumAcceptance: 0.0%

The fraction 49/98 is curious: by cancelling the 9 from numerator and denominator, we get 4/8, which equals 49/98. We consider fractions less than 1 with two-digit numerator and denominator. Given max_den, consider all such curious fractions with denominator <= max_den. If the product of all these fractions is given in lowest terms, find the denominator.

Example 1:

Input: 99
Output: 100

Example 2:

Input: 70
Output: 10

Example 3:

Input: 60
Output: 1

Constraints:

10 <= max_den <= 99

Tags:

math fractions gcd
Loading...
Test Cases:No test cases
No test cases available.
Coding Problem Not Found | CodeTikki