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 1114. Boxes

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?
Posted by Osama Ben Laden 4 Mar 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?
Posted by Algorist 4 Mar 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?
Posted by Osama Ben Laden 5 Mar 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?
Posted by Eugene Nikanorov 17 Apr 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.