Page **1** of **1**

### Re: 10916 Please help!!!!!!!!!!!

Posted: **Sun Oct 02, 2005 12:21 am**

by **kp**

pradeepm wrote:Hi!!

I feel this problem is very simple but i keep getting WA. isnt the answer same for 1960-1969,1970-1979,...

please give me some test cases. please help me..

regards,

Pradeep

Yes, answer is the same for XXX0 - XXX9.

Test:

Answer:

### 10916 - Factstone Benchmark

Posted: **Mon Nov 07, 2005 9:34 am**

by **soyoja**

This is so simple problem, and I use my BigInteger class

( I think it's so fast )

But When my test year exceed 2100 then running speed

was seriously slower. ( it must calculate over 3000! )

Is there any technique for solving this problem?

Plz tell me about hint.

// my pseudo code

while( bits can represent factorial )

{

next_number++;

factorial *= next_number;

}

return next_number;

Posted: **Mon Nov 07, 2005 9:43 am**

by **wook**

well, biginteger method would not be so fast,

since artimethic using BigInteger is too slow to process such a big number,

thus you cannot use BIGINTEGER method!

Think about logarithms, then problem becomes more simple.

hint) log(100!) = log(1 * 2 * 3 * ... * 100) = log1 + log2 + ... + log100

### Re: 10916 Time limit exceed problem

Posted: **Sat Dec 10, 2005 9:39 pm**

by **Martin Macko**

soyoja wrote:This is so simple problem, and I use my BigInteger class

( I think it's so fast )

But When my test year exceed 2100 then running speed

was seriously slower. ( it must calculate over 3000! )

Is there any technique for solving this problem?

Plz tell me about hint.

// my pseudo code

while( bits can represent factorial )

{

next_number++;

factorial *= next_number;

}

return next_number;

Think about this sentence in the problem statement:

problem statement wrote:Given a year 1960 ≤ y ≤ 2160

Posted: **Wed May 10, 2006 1:12 am**

by **Ankur Jaiswal**

isnt the answer going to be

the 21 values

for the set of years??

if yes then why am i getting WA?otherwise where am i wrong?

is there any boundary condition?

Posted: **Wed May 10, 2006 6:49 am**

by **mamun**

Ankur Jaiswal wrote:isnt the answer going to be

...

for the set of years??

Do you understand that set of years is [1960,2160]?

Posted: **Wed May 10, 2006 11:18 am**

by **Ankur Jaiswal**

so that is what i am saying..

3 for the set of years 1960-1969

5 for 1970-1979

and so on.

isn't that rite?

Posted: **Wed May 10, 2006 11:44 am**

by **mamun**

That is right. The I/O specification is too straightforward to do a mistake. Anyway you can try this

Code: Select all

```
1999
2000
2001
1960
1961
2160
2159
2160
```

### my answers

Posted: **Wed May 10, 2006 11:47 am**

by **Ankur Jaiswal**

12

20

20

3

3

254016

134480

254016

### Re: my answers

Posted: **Tue Mar 15, 2011 7:48 pm**

by **DD**

Ankur Jaiswal wrote:12

20

20

3

3

254016

134480

254016

Your output is identical mine. I think your functionality should be right, but you may need to check that your program can terminate correctly or not.

### Re: 10916 - Factstone Benchmark

Posted: **Tue Feb 25, 2014 2:23 pm**

by **uDebug**

Replying to follow this thread.