Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Code The fraction 4 9 / 9 8 is a curious fraction. An inexperienced mathematician while attempting to simplify it may incorrectly believe that

Python Code
The fraction 49/98 is a curious fraction. An inexperienced mathematician while attempting to simplify it may incorrectly believe that 49/98=4/8 is obtained by cancelling the 9s.
We shall consider fractions like, 30/50=3/5, to be trivial examples.
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
Constraints
2<=N<=4
1<=K<=N-1
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.
Sample Input
21
Sample Output
110322

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions

Question

What is an ABS? What is a waterfall in an ABS?

Answered: 1 week ago