Problem Link:
Difficulty:
Easy
Pre-requisites:
Basic math
Explanation:
Sub task 1:
In this subtask the summands will decrease very fast because a is actually small, so it’s enough just to calculate the sum
for all n smaller of equal to 100 and this should be enough.
All the sub tasks:
The following fact is important: all the fractions are given with exactly two digits after the decimal point. Because
of this, we can convert the input to common fractions with denominator not exceeding 100. So, we’ve got rid of the
floating point numbers.
Then, let’s make some observations regarding the sum itself:
So, now we see that the answer can be represented as a common fraction. Outputting the first D digits of a common fraction is a
standard and a well known trick, you can see the problem APPROX or setter’s solution for details.
Setter’s Solution:
Can be found here
Tester’s Solution:
Can be found here