Page 1 of 2
10856 - Recover Factorial
Posted: Sat May 28, 2005 4:08 pm
by BiK
How is this problem solved? It appears everybody but me solved it

Posted: Sat May 28, 2005 4:27 pm
by zhang

I want to know,also. I can't solve this problem in 2s.
Tell me and Bik how to solve the problem.
Posted: Sun May 29, 2005 6:45 am
by mohiul alam prince
Hi
I have solve this problem by this way
- First i have stored some prime number
- Then i have stored number of factor's in a single number by using DP.
- Then binary search
Thanks
MAP
Posted: Mon May 30, 2005 2:23 pm
by windows2k
mohiul alam prince wrote:Hi
I have solve this problem by this way
- First i have stored some prime number
- Then i have stored number of factor's in a single number by using DP.
- Then binary search
MAP
Sorry, I got WA all the time.
Could you give me some tricky input/output?
Thx
Posted: Mon May 30, 2005 2:50 pm
by Monsoon
Maybe this, in the problem statement is:
A negative integer marks is the end of input, not -1.

I have 2 WAs becouse of that...
Posted: Mon May 30, 2005 3:22 pm
by windows2k
Monsoon wrote:Maybe this, in the problem statement is:
A negative integer marks is the end of input, not -1.

I have 2 WAs becouse of that...
I have noticed the point.
When I input 0, it is impossible or 1! ?
Posted: Mon May 30, 2005 3:26 pm
by Monsoon
neither of them, i output 0 (0!=1) and it is the smallest number
Posted: Tue May 31, 2005 8:36 am
by mohiul alam prince
Hi
Try this Input
Input
Output
Code: Select all
Case 1: 0!
Case 2: 2!
Case 3: 2703663!
I think this is the most tricky Input for this problem.
Thanks
MAP
10856
Posted: Thu Jul 07, 2005 8:29 pm
by schindlersp
0! = 1
am i right? i think so is not possible this case.
Posted: Wed Jul 27, 2005 5:13 am
by ibrahim
mohiul alam prince wrote:Hi
I have solve this problem by this way
- First i have stored some prime number
- Then i have stored number of factor's in a single number by using DP.
- Then binary search
Thanks
MAP
I tried to store prime upto 2703663 and it take 1.6 MB.
Can you write details?
Posted: Wed Jul 27, 2005 12:15 pm
by mohiul alam prince
Hi ibrahim
suppose you have a list of prime number
- prime[] = {2,3,5,7,11,13,17,19,23,29,............................}
- and my concept is if a number is divisible by a prime number then it is suffice for find out total number of prime factor.
exp - if we have a number 12
then we have to check which prime number is divisible then 2 will be come and
then ans will be Table
= Table[i / prime[j]] + Table[prime[j]];
here i = 12
prime[j] = 2
then Table[12] = Table[12/2] + Table[2]
then we can easily find out Table[12] = 3:-?
and it will be continue up to 2703665
- then binary search
thanks
MAP
Posted: Sat Aug 20, 2005 11:39 am
by Nazmul Quader Zinnuree
Table = Table[i / prime[j]] + Table[prime[j]];
what does this table contain at last...
how does it help....
plz, give me explanations and some starting values in the generated table
Thanks !
Posted: Thu Apr 13, 2006 4:35 am
by FAQ
I don't understand too
12 has another prime factor is 3 then table[12] = table[4] + table[3] + table[6] + table[2] ?
some little more details please?
Posted: Tue Jul 04, 2006 10:51 am
by a123123123888
The table at last is like this:
Code: Select all
Table[0]=0
Table[1]=0
Table[2]=1
Table[3]=1
Table[4]=2
Table[5]=1
Table[6]=2
Table[7]=1
Table[8]=3
...
This means the number's "factors" --> I don't know whether this word or not
Example
8 = 2 * 2 * 2
So Table[8]=3
to FAQ:
Code: Select all
Table[4]+Table[3]+Table[6]+Table[2]
means
Code: Select all
Table [ 4 * 3 * 6 * 2 ] = Table[144]
and obviously not equal to Table [12].
By the way, it's not necessary to calculate prime numbers.
Posted: Sun Jul 30, 2006 6:35 am
by Moha
Can anybody post some testcases? My code seems to be correct but still WA.
now I got it, I didn't print the '.' !!!