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 1011. Conductors

(C++)Got WA on test14, can you help me?
Posted by Boqian Jiang 6 Mar 2010 18:01
#include <cstdlib>
#include <iostream>
#include <iomanip>

using namespace std;

int main(int argc, char *argv[])
{

    double a,b,c,d,m,n=2,mn;
    cin>>a>>b;
    c=a/100;
    d=b/100;
    while (1)
    {m=1;
     while (m<n)
    {mn=m/n;
     if ((mn<d)&&(mn>c)) break;
     m++;}
     if (m!=n) break;
     n++;}
     cout<<n<<endl;
    system("PAUSE");
    return EXIT_SUCCESS;
}




This is my project Got WA on test14.
I think there's something wrong with digits
But i cannot find it
Can anyone help me with it?
Thx!
Re: (C++)Got WA on test14, can you help me?
Posted by OpenGL 21 Mar 2010 00:07
I think, your mistake in precision. Try change:
if ((mn<d)&&(mn>c)) ->
if ((mn+eps<d)&&(mn-eps>c))