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 1200. Horns and Hoofs

Test #14
Posted by aSSault 4 May 2007 13:41
Re: Test #14
Posted by Romko [Lviv NU] 5 May 2007 16:49
When my program had WA14,
I changed there:
if(a - int(a) >= 0.5)
to
if(a - int(a) >= 0.5 + 1e-7)
And I get AC!!
Maybe it will help you! Good Luck!!!

Edited by author 05.05.2007 16:50
Re: Test #14
Posted by [RSU_Tash]Nodirbek_Kuklamov 30 Jan 2011 22:47
Please, help WA 14.  How can I change this?
I think there is my mistake:

pr_x >= pr_y   and    pr_y >= pr_x

-----------------------------
      double a = input.nextDouble(), b = input.nextDouble();
        double pr_x = 0, pr_y = 0;
        int x = 0, y = 0, k = input.nextInt();
        boolean yes;
        while (true) {
          pr_x = a - 2 * x - 1;
          pr_y = b - 2 * y - 1;
            yes = false;
            if (pr_x > 0 && pr_x >= pr_y && x + y + 1 <= k) {
                yes = true;
                x++;
            } else if (pr_y > 0 && pr_y >= pr_x && x + y + 1 <= k) {
                yes = true;
                y++;
            }
            if (!yes) {
                break;
            }
        }
        System.out.printf("%.2f\n%d %d\n", a * x + b * y - x * x - y * y, x, y);
    }

Edited by author 30.01.2011 22:48