Description
This problem is a programming version of Problem 33 from projecteuler.net
98
that 49 = 4 is obtained by cancelling the 9s.
98 8
We shall consider fractions like, 30 = 3, to be trivial examples.
50 5
Which means fractions where trailing 0’s are cancelled are trivial. So we will ignore all the cases where we have to cancel 0’s.
You will be given 2 integers N and K. N represents the number of digits in Numerator and Denominator, and K represents the exact number of digits to be “cancelled” from Numerator and Denominator. Find every non-trivial fraction, (1) where numerator is less than denominator, (2) and the value of the reduced fraction is equal to the original fraction.
Sum all the Numerators and the Denominators of the original fractions, and print them separated by a space.
Input Format
Input contains two integers N K
Output Format
Display 2 space separated integers that denote the sum of the Numerators and the sum of the Denominators respectively of original fractions.
Note You do not have to reduce the Numerator and Denominator.
Constraints
2≤N≤4 1≤K≤N−1
Sample Input
Sample Output




Reviews
There are no reviews yet.