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

Need help for problem 1011 : Conductors
Posted by Timus Observer 4 Sep 2001 20:49
Could someone give me some hints for problem 1011. I can
pass the test case but keep getting WA. Looks like there is
a test case that the program can not pass.
I past the tast case too
Posted by Algorist 5 Sep 2001 03:33
Here s my algo
i=0
while not found solution do
    i=i+1
    if trunc(i*inputted1)<>trunc(i*inputted2) then found
solution=true
output(i)

That's all. I'm perfectly sure it's correct, I've submitted
it in Pascal as well as in C++, but I got C++(in C++
instead of trunc I use floor). Do you do the same?
pass the tast case too, mistakes corrected
Posted by Algorist 5 Sep 2001 03:40
Oops, i made some mistakes. I meant
 Here s my algo
 i=0
 while not found solution do
     i=i+1
     if trunc(i*inputted1/100)<>trunc(i*inputted2/100) then
found
 solution=true
 output(i)

 That's all. I'm perfectly sure it's correct, I've
submitted
 it in Pascal as well as in C++, but I got C++(in C++
 instead of trunc I use floor). Do you do the same?
Always WA
Posted by Timus Observer 5 Sep 2001 06:57
>  That's all. I'm perfectly sure it's correct, I've
> submitted
>  it in Pascal as well as in C++, but I got C++(in C++
>  instead of trunc I use floor). Do you do the same?
I did the same thing but always got WA:
program pr1011_conductors;
var sol : integer;
    pct1, pct2 : real;
    found : boolean;
begin
found:=false;
sol:=0;
read(pct1,pct2);
while not found do
begin
  inc(sol);
  if trunc(sol*pct1/100) <> trunc(sol*pct2/100) then
found:=true;
end;
writeln(sol);
end.
Re
Posted by Algorist 5 Sep 2001 21:38
HA-HA
My code is EXACTLY the same only the variable names differ
from yours. BUT I haven't been ever more sure that program
is correct. THERE'S JUST NO PLACE TO GET WRONG. So, as
someone said in this forum but stopped helping :
In Pascal, Real TYPE can be round, and it make incorrect.
Use ROUND Function to fix it.
If it still get WA, Call me.

Do you get this? Cause I can't.. Too bad English or what?
Re
Posted by Timus Observer 6 Sep 2001 08:16
> In Pascal, Real TYPE can be round, and it make incorrect.
> Use ROUND Function to fix it.
> If it still get WA, Call me.
>
> Do you get this? Cause I can't.. Too bad English or what?
I do not understand either. I also have tried with:
trunc(....) - trunc(...) > 1E-15 but still get the same
result.
Re
Posted by Alexander 24 Sep 2001 23:12
> > In Pascal, Real TYPE can be round, and it make
incorrect.
> > Use ROUND Function to fix it.
> > If it still get WA, Call me.
> >
> > Do you get this? Cause I can't.. Too bad English or
what?
> I do not understand either. I also have tried with:
> trunc(....) - trunc(...) > 1E-15 but still get the same
> result.

Pay attention to the fact that P and Q are STRICT
estimations!