You are not logged in. Please login at www.codechef.com to post your questions!

×

LMA1 - Editorial

Problem Link:

Practice
Contest

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:

alt text

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

asked 24 Nov '13, 14:42

xcwgf666's gravatar image

6★xcwgf666 ♦♦
719436377
accept rate: 0%

edited 16 Jun '15, 11:26

vicky002's gravatar image

1★vicky002 ♦♦
2561314


whats wrong in my solution ?

link

answered 24 Nov '13, 14:49

r3gz3n's gravatar image

4★r3gz3n
52128
accept rate: 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<d;i++) { rem=rem*10; cout<<(int)rem; rem=rem-(int)rem; }

link

answered 24 Nov '13, 20:38

devil_coder's gravatar image

2★devil_coder
30125
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • 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