×

Easy

Basic math

# Explanation:

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.

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

719436377
accept rate: 0%

2561314

 0 whats wrong in my solution ? answered 24 Nov '13, 14:49 4★r3gz3n 52●1●2●8 accept rate: 0%
 0 Can this question will be explained a little more in terms of code. I calculated the formula correct and solved it directly putting the values in the formula. and printed result to D decimal places using rem=sol-(int)sol; for(i=0;i
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×15,680
×3,766
×877
×10
×2

question asked: 24 Nov '13, 14:42

question was seen: 2,056 times

last updated: 16 Jun '15, 11:26