Monday, February 20, 2012

[Codechef] ATM (HS08TEST)

The problem is totally straightforward. Only possible cause for wrong answer response is if x = y. In that case you should check if x+0.5 > y or not.

#include <stdio.h>

int main()
{
    int x;
    double y;
    while (scanf("%d %lf",&x,&y)==2)
    {
        if (!(((double)x+0.5)>y) && !(x%5))
            printf("%.2lf\n",y-(double)x-0.5);
        else
            printf("%.2lf\n",y);
    }
    return 0;
}

No comments:

Post a Comment

Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.

Connect Rapoo MT750S with Linux (Tested on Manjaro)

 I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...