ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1621. Definite Integral

Can someone give me any tips for test #11 pls
Posted by HeypaBHoBeceH 30 Oct 2008 13:04
First I thought it was precision but now I don't know anymore.
I thought i would never post a thread like this one but...
Can someone give me any tips for test #11 pls
Posted by HeypaBHoBeceH 30 Oct 2008 17:54
this is a part of my code, f_x() is P(x):
left1 = left2 = f_x(0);
for(x = 1e-3 ; x < 6000 ; x += 1e-3)
    {
        y1 = f_x(+ x);
        y2 = f_x(- x);
        ans += ((((left1 + y1)/left1)/y1)) + ((((y2 + left2)/y2)/left2));
        left1 = y1;
        left2 = y2;
    }
    ans *= 0.5*(1e-3);
Re: Can someone give me any tips for test #11 pls
Posted by Anisimov Dmitry (Novosibirsk STU) 6 Nov 2008 00:06
Try to use dx and limits which can be represented in binary form exactly (e.g. 1/1024.0 instead of 1e-3)
Re: Can someone give me any tips for test #11 pls
Posted by HeypaBHoBeceH 17 Nov 2008 23:45
appreciate the tip, but still WA11...
Re: Can someone give me any tips for test #11 pls
Posted by Anisimov Dmitry (Novosibirsk STU) 6 Dec 2008 22:36
Why are you using plus-minus 6000 as limits?
1/P(x) could have its maximum as far as x = 10^6 and a bit further.

Edited by author 06.12.2008 22:36
Re: Can someone give me any tips for test #11 pls
Posted by HeypaBHoBeceH 2 Jun 2009 13:47
nvm, Accepted!

Edited by author 02.06.2009 14:16
Re: Can someone give me any tips for test #11 pls
Posted by xurshid_n 31 Jan 2012 13:48
Thank you a lot, I AC!!!!!!!!!!!!!!