It won't get TLE, forget about anupam's posts -- he's wrong (btw, never trust posts written in bold (and italic) fonts).
Even if you'll declare array as char facts[1001][2600] it will only takes 2.5M of memory. Is this too much? Don't think so.
About computation, it's trivial:
BigInteger facts ...
Search found 167 matches
- Tue Jan 27, 2004 11:02 am
- Forum: Volume 6 (600-699)
- Topic: 623 - 500!
- Replies: 187
- Views: 71477
- Sun Jan 18, 2004 11:50 pm
- Forum: Volume 6 (600-699)
- Topic: 623 - 500!
- Replies: 187
- Views: 71477
- Fri Sep 26, 2003 6:31 pm
- Forum: Volume 1 (100-199)
- Topic: 127 - "Accordian" Patience
- Replies: 83
- Views: 21322
Of course, gets faster than cin, as well as fread faster than gets. About fread parameters -- you can use stdin (and stdout for fwrite). STL, obviously, very slow for this problem because it contains too much unnecessary code (for this problem especially). Own stack routines + own I/O routines are ...
- Tue Sep 02, 2003 1:24 pm
- Forum: Volume 104 (10400-10499)
- Topic: 10402 - Triangle Covering
- Replies: 37
- Views: 11473
- Sat Aug 09, 2003 4:20 pm
- Forum: Volume 102 (10200-10299)
- Topic: 10254 - The Priest Mathematician
- Replies: 10
- Views: 7114
Yeah, bigint is necessary to solve this problem. However my accepted solution for input 9876 produces this answer:
Code: Select all
202100503361683772220167446845875776147947521
- Wed Jul 16, 2003 9:33 am
- Forum: General
- Topic: SECURITY FLAW IN ONLINE JUDGE
- Replies: 34
- Views: 13417
- Thu Jun 12, 2003 12:02 pm
- Forum: Volume 1 (100-199)
- Topic: 128 - Software CRC
- Replies: 62
- Views: 14543
Input:
Your output:
Code: Select all
RFC: 793
#
Code: Select all
10A 21
- Thu May 22, 2003 11:37 am
- Forum: Other words
- Topic: The new leader is coming........
- Replies: 6
- Views: 5041
- Sat Apr 19, 2003 11:18 am
- Forum: Volume 7 (700-799)
- Topic: 727 - Equation
- Replies: 156
- Views: 56728
- Mon Feb 24, 2003 12:03 pm
- Forum: C++
- Topic: How to combine a char & a word ?!?
- Replies: 13
- Views: 6488
- Sat Feb 15, 2003 2:12 pm
- Forum: Volume 6 (600-699)
- Topic: 631 - Microzoft Calendar
- Replies: 11
- Views: 8887
- Mon Feb 03, 2003 1:18 pm
- Forum: Volume 1 (100-199)
- Topic: 114 - Simulation Wizardry
- Replies: 80
- Views: 16278
- Mon Feb 03, 2003 11:49 am
- Forum: Volume 1 (100-199)
- Topic: 128 - Software CRC
- Replies: 62
- Views: 14543
- Mon Feb 03, 2003 11:45 am
- Forum: Volume 1 (100-199)
- Topic: 114 - Simulation Wizardry
- Replies: 80
- Views: 16278