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

why wrong answer
Posted by edward 23 Jan 2011 20:21
do anybody know why its wrong
#include <cstdlib>
#include <iostream>
#include <math.h>
using namespace std;

int main(int argc, char *argv[])
{
    float l, h, omega;
    double long wynik, obroty_wykonane;

    cin>> l >> h >> omega;
          obroty_wykonane=((omega/60)*sqrt(((h-(0.5*l))/450.5)));
          wynik=obroty_wykonane-floor(obroty_wykonane);
    if (wynik>0.25 && wynik<0.75) {cout << "bread"<< endl;}
    else {cout << "butter"<< endl;}
    return EXIT_SUCCESS;
}
No subject
Posted by happylist 28 Jan 2011 23:14
Try it:
//--------------------
var c,l,h,w,t:real;
begin
readln(l,h,w);
h:=h/100;
l:=l/100;
w:=w/60;
if l/2>=h then  writeln('butter') else begin
h:=h-0.5*l;
t:=sqrt(abs((2*h)/9.81));
c:=t*w;
while c>1 do c:=c-1;
if ((c<0.25)or(c>0.75)) then write('butter') else write('bread'); end;
readln;
end.
//-------------


Edited by author 29.01.2011 00:37