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 1800. Murphy's Law

SpartakusMd WA#15 [3] // Problem 1800. Murphy's Law 11 Mar 2012 00:28
Where is the error in my code?
Please, help...

#include <stdio.h>
#include <conio.h>
#include <math.h>

int main() {
    float l, h, w, n, t;

    scanf("%f%f%f", &l, &h, &w);

    h /= 100;
    l /= 100;
    w /= 60;

        h -= l/2;
        t = sqrt(2*h/9.81);
        n = t*w;
        n -= (int) n;
        if(n <= 0.25 || n >= 0.75) printf("butter");
        else printf("bread");


    return 0;
}
falicos Re: WA#15 [2] // Problem 1800. Murphy's Law 12 Mar 2012 23:56
The first change float to  double and respectivly change scanf like this
 double l, h, w, n, t;

    scanf("%lf%lf%lf", &l, &h, &w);
and add the case
if( l/2>h ){
printf("butter");
return 0;
}
and your  get AC
falicos Re: WA#15 // Problem 1800. Murphy's Law 13 Mar 2012 00:01
Sorry I didnot sea that your allready  have AC on this problem 20:49:45
12 мар 2012
SpartakusMd Re: WA#15 // Problem 1800. Murphy's Law 14 Mar 2012 22:36
Thanks