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

What can be on WA#4
Posted by Nilrem 23 Oct 2005 00:39
#include <stdio.h>
#include <math.h>
int main()
{
    float a,b,c;
    int i;
    scanf("%f %f %f",&a,&b,&c);
    i=log(b/a)/log((100-c)/100)+1;
    printf("%d",i);

}

it's simple code fails on fourth test... (WA#4)
What can it be ?
Re: What can be on WA#4
Posted by Tutanhamon 7 Mar 2008 00:28
Here is my code:

Program Acm_Timus_1283;
var
  i,k0,km:longint;
  n,log:real;
begin
  Readln(k0,km,n);
  n:=(100-n)/100;
  log:=((ln(km)-ln(k0))/ln(n));
  i:=trunc(log);
  if log-trunc(log)>0.0000000001 then
  inc(i);
  Writeln(i);
end.


Wa#4 too(((
Re: What can be on WA#4
Posted by Armen Tsirunyan 17 Dec 2008 21:05
I had WA4 too. But then  found my mistake(noting to do with precision, actually:)). The thing is that if first number is less or equal that the second then 0 should be output. I suo=ppose your program outputs a negative number:)
Re: What can be on WA#4
Posted by Ekvilon 10 Oct 2009 04:09
No doubt, if the dwarf has less money than he should have for his life not to be senseless, he doesn't live at all. When I corrected this mistake, i got AC instead WA#4.