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

Обсуждение задачи 1114. Коробки

I compared my solution (1114 - "Boxes") for most of all posible tests with Accepted one, but it's still WA. Can anybody give me a hint?
Послано Osama Ben Laden 4 мар 2002 16:56
Here is my solution:

#include <fstream.h>
#include <stdio.h>

int n,a,b;
long double x[21][16][16];
int main()
{
 cin>>n>>a>>b;

 {
  for(int ai=0; ai<=a; ai++)
   for(int bi=0; bi<=b; bi++)
    x[0][ai][bi] = 1;
 }

 for(int in=1; in<=n; in++)
  for(int ia=0; ia<=a; ia++)
   for(int ib=0; ib<=b; ib++)
 {
   long double xx = 0;
   for(int ai=0; ai<=ia; ai++)
    for(int bi=0; bi<=ib; bi++)
     xx += x[in-1][ia-ai][ib-bi];
   x[in][ia][ib] = xx;
 }

/* cout.setf(ios::fixed);
 cout.precision(0);
 cout<<x[n][a][b]<<endl;*/
 printf("%.0Lf\n",x[n][a][b]);
 return 0;
}
Re: I compared my solution (1114 - "Boxes") for most of all posible tests with Accepted one, but it's still WA. Can anybody give me a hint?
Послано Algorist 4 мар 2002 20:46
You cannot accept a solution with long double. I write one by myself,
and kept getting WA, even though I tested it with the tests from the
Bulgarian competition. It just doesn't work on Timus. You'll have to
use bignum  :(
But I compared my solution for extreme tests (like 20,15,15), and it was the same with AC one. How can it be?
Послано Osama Ben Laden 5 мар 2002 20:37
> You cannot accept a solution with long double. I write one by
myself,
> and kept getting WA, even though I tested it with the tests from
the
> Bulgarian competition. It just doesn't work on Timus. You'll have
to
> use bignum  :(
Re: But I compared my solution for extreme tests (like 20,15,15), and it was the same with AC one. How can it be?
Послано Eugene Nikanorov 17 апр 2002 11:34
U probably writing in Borland C++ where long double have 80-bit
precision, and timus uses MSVC 6.0 compiler where long double is
equal to double and is 64 bit. I had the same problem, and i've post
solution in Pascal, later in C++ with long nums.