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 1820. Ural Steaks

Test 1 - WRONG. Please help
Posted by vokson 1 Oct 2012 09:24
There is my code on C. All test I found are passed. For example:
hot (3,2) == 3);
hot (3,10) == 2);
hot (1,5) == 2);
hot (5,3) == 4);
hot (10,3) == 7);
hot (7,3) == 5);
hot (9,5) == 4);
But server says that anyway test 1 - wrong. What is wrong?
Please give me any test, which my program can't decide corectly.

int hot (int n1, int k) {
   int n2, minutes = 0;

   //Жарим первую сторону по максимальному числу бифштексов
    minutes += n1/k;
    //Пожаренные первые стороны становятся недожаренными вторыми
    n2 = minutes * k;
    //Ищем недожаренные первые стороны
    n1 -= minutes*k;
    //Докладываем на сковороду n2, если есть
    if (n2 > 0) {
        n2 -= (k-n1);
        if (n2<0) n2=0;
    }
    //Жарим остатки n1 и то, что доложили
    minutes++;
    //Пожаренное n1 переходит в n2
    n2 += n1; n1 = 0;
    //Жарим вторую сторону
    minutes += (int) ceil((float)n2/k);

    return minutes;
}

int main() {
    int n,k;

    scanf("%d %d",&n, &k);

    printf("%d", hot(n,k));

    return (EXIT_SUCCESS);
}

Edited by author 01.10.2012 09:26
Re: Test 1 - WRONG. Please help
Posted by lomobit 9 Nov 2012 00:41

Edited by author 09.11.2012 00:48

Edited by author 09.11.2012 00:48