623 - 500!

All about problems in Volume VI. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Re: 623 - 500!

Postby Scarecrow » Sun Jan 22, 2012 1:04 pm

for some strange reasons, my code is getting RE. i used the same code for 324 - Factorial Frequencies and got AC.for this prob, increased the limit of the strings as needed and i'm getting RE! can sm1 help me :(

Code: Select all
removed after AC
Do or do not. There is no try.
Scarecrow
Learning poster
 
Posts: 69
Joined: Wed Oct 19, 2011 9:06 pm

Re: 623 - 500!

Postby kia.masster » Thu May 24, 2012 8:01 am

In this problem we must precalculate all possible factorials, and print them out when requested. Calculate factorials of 1 to 1000 takes so mush time. What is the good way to find them?

Code: Select all
bignum f[1001];

int main(){
   int n;
   f[0] = bignum("1");
   f[1] = bignum("1");
   for (int i = 2; i <= 1000; i++)
      f[i] = f[i - 1] * bignum(i);
   while (cin >> n)
      cout << n << "!" << endl << f[n] << endl;
}


Thank you!
kia.masster
New poster
 
Posts: 6
Joined: Thu Dec 22, 2011 8:47 am

Re: 623 - 500!

Postby brianfry713 » Thu May 24, 2012 9:57 am

Yes precalculate them. It shouldn't take too long.
brianfry713
Guru
 
Posts: 1765
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 623 - 500!

Postby uvasarker » Sun Nov 04, 2012 8:47 am

I am new in (Uva+Java). Please, help me. I am getting Rumtime error. why?
Code: Select all
/* Removed */
Last edited by uvasarker on Tue Nov 06, 2012 9:08 pm, edited 1 time in total.
uvasarker
Learning poster
 
Posts: 96
Joined: Tue Jul 19, 2011 12:19 pm
Location: Dhaka, Bangladesh

Re: 623 - 500!

Postby brianfry713 » Tue Nov 06, 2012 2:10 am

brianfry713
Guru
 
Posts: 1765
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 623 - 500!

Postby uvasarker » Tue Nov 06, 2012 9:08 pm

WOW! ACCCCC! thanks guru.
uvasarker
Learning poster
 
Posts: 96
Joined: Tue Jul 19, 2011 12:19 pm
Location: Dhaka, Bangladesh

Previous

Return to Volume VI

Who is online

Users browsing this forum: No registered users and 1 guest