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

Обсуждение задачи 2011. Длинное условие

Runtime error (integer division by zero) in test 70
Послано Anton Malyuta 9 ноя 2013 20:20
My code:

/*
Code deleted.
*/

we get the WA12.

What's the problem?

Edited by author 09.11.2013 22:57
Re: Runtime error (integer division by zero) in test 70
Послано AlexandruValeanu 9 ноя 2013 21:20
You will easily get overflow... 100! ~ 9*10^157 which is a "little" too big
Re: Runtime error (integer division by zero) in test 70
Послано Anton Malyuta 9 ноя 2013 21:41
Oh, right! Thank you very much.
It turns out I have the wrong formula?
Re: Runtime error (integer division by zero) in test 70
Послано Anton Malyuta 9 ноя 2013 22:56
Thank you very much. I change long long to double. ;)
Re: Runtime error (integer division by zero) in test 70
Послано Vedernikoff 'Goryinyich' Sergey (HSE: АОП) 10 ноя 2013 18:45
This problem is possible to solve without any formulas - just using one sorting of 3-element array and 3 IF statements - so, you won't have problems with overflows
Re: Runtime error (integer division by zero) in test 70
Послано Anton Malyuta 11 ноя 2013 15:49
Thank you.
Re: Runtime error (integer division by zero) in test 70
Послано Anton Malyuta 11 ноя 2013 15:49
Thank you. I got AC.
Re: Runtime error (integer division by zero) in test 70
Послано un_try 4 сен 2014 03:42
Please, could you explain a bit more your approach?
Re: Runtime error (integer division by zero) in test 70
Послано Zoom 5 сен 2014 03:16


Edited by author 05.09.2014 03:37
Re: Runtime error (integer division by zero) in test 70
Послано Zoom 5 сен 2014 03:36
Just got A.C
Just need to change all variable and return values to double.
Count number of 1s 2s and 3s.
Take the factorials of these numbers however you feel right, divide by total length,n.
un_try писал(a) 4 сентября 2014 03:42
Please, could you explain a bit more your approach?
Re: Runtime error (integer division by zero) in test 70
Послано un_try 5 сен 2014 06:04
Thanks you very much!

I did this: 4 If. One for n > 5, the another threes for n == 5, n == 4 and n == 3.