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 1283. Dwarf

Any mistake about precision?
Posted by Maigo Akisame (maigoakisame@yahoo.com.cn) 28 Sep 2004 18:12
program ural1283;
const
  zero=1e-6;
var
  a,b:longint;
  c:real;
begin
  read(a,b,c);
  writeln(trunc(ln(b/a)/ln(1-c/100)+1+zero));
end.
If formula fails just try simulation :) (-)
Posted by Dmitry 'Diman_YES' Kovalioff 28 Sep 2004 22:34
But still WA #1!
Posted by Maigo Akisame (maigoakisame@yahoo.com.cn) 29 Sep 2004 12:20
My old formula was wrong, and a new one is here in the prog below.

When I submit, I comment out either part. But neither simulation nor formula works, they both get WA #1.

BTW, what is the output for 2 1 50? Is it 1 or 2?

program ural1283;
var
  b,ans:longint;
  a,c:real;
begin
  read(a,b,c);
  c:=1-c/100;
//Simulation:
  while a>=b do begin
    inc(ans);
    a:=a*c;
  end;
  writeln(ans);
//Formula:
  ans:=trunc(ln(b/a)/ln(c)+1);
  if ans<0 then writeln(0) else writeln(ans);
end.
Check your mail (-)
Posted by Dmitry 'Diman_YES' Kovalioff 29 Sep 2004 13:57