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

solve
Posted by gyz113 15 Feb 2008 16:23
var
a:longint;
p,q:extended;
begin
read(p,q);
p:=p/100;
q:=q/100;
a:=-1;
repeat
inc(a);
until (trunc(a*q-0.0000000000000001)-trunc(a*p+0.0000000000000001))>0;
write(a);
end.

-_-!
Re: solve
Posted by olpetOdessaONU 3 May 2008 15:31
#include<iostream>
using namespace std;
int res(int a, int b)
{
    for(int i=1; i<=10001; i++)
    {
        long long x=(i*a);
        long long y=(i*b);
        long long z=((long long)(y/10000))*10000;
        if((x<z)&&(z<y))
        {return i;}
    }
}
int main()
{
    double a,b;
    cin>>a>>b;

    int a1=(int)(100.0*a+0.5);
    int b1=(int)(100.0*b+0.5);
    cout<<res(a1,b1)<<endl;
    return 0;
}