ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1526. Martian Plates

Yermak First test doesn't fit the statement limitations! (+) [6] // Задача 1526. Martian Plates 11 авг 2012 20:38
#include <stdio.h>
int p,t,n,m;
int main()
{
    scanf("%d%d%d%d",&p,&t,&n,&m);
    if (p<2 || p>10000 || t<2 || t>200 || (t&1) || n<1 || n>10 || m<1 || m>100)
        return 1/(p-p);
    return 0;
}

This program gets "Crash (integer division by zero)" at test #1.
http://acm.timus.ru/status.aspx?space=1&num=1526
Sandro (USU) Re: First test doesn't fit the statement limitations! (+) [5] // Задача 1526. Martian Plates 12 авг 2012 13:08
You are right, m = 0 in the 1st test. This limitation in the problem statement is fixed now.
Andrew Sboev [USU] Re: First test doesn't fit the statement limitations! (+) [4] // Задача 1526. Martian Plates 12 авг 2012 16:06
But there is a division by zero in his code! Sandro, why did you delete my post?
Sandro (USU) Re: First test doesn't fit the statement limitations! (+) [3] // Задача 1526. Martian Plates 13 авг 2012 01:34
Because the solution of Yermak is a input validator. If the system verdict on some test is Crash (division by zero), then this test is incorrect. If the test is correct, system verdict should be Wrong Answer.
Andrew Sboev [USU] Re: First test doesn't fit the statement limitations! (+) [2] // Задача 1526. Martian Plates 13 авг 2012 11:54
Sandro, look at this line of his code! There is a division by zero if condition is true, because p-p = 0!

if (p<2 || p>10000 || t<2 || t>200 || (t&1) || n<1 || n>10 || m<1 || m>100)
        return 1/(p-p);


Edited by author 13.08.2012 11:55
Captain Obvious to the rescue!
Andrew Sboev [USU] Re: First test doesn't fit the statement limitations! (+) // Задача 1526. Martian Plates 14 авг 2012 00:03
Noob, oh, i understand.

Edited by author 14.08.2012 00:04