求大数阶乘的快速算法!!!急5
发布网友
发布时间:2023-10-28 21:16
我来回答
共4个回答
热心网友
时间:2024-11-23 15:35
或者你先自己算一遍。。给写在哪个文件里,然后再算的时候直接读取就行了,半秒都用不了……
热心网友
时间:2024-11-23 15:36
你做梦呢,10000的阶乘就够你算N辈子了,还100000,你不如
算100000的100000次方,全是0的话你还有可能数的过来,可能性为0~~~
热心网友
时间:2024-11-23 15:36
For numIndex As Integer = 2 To number
carry = 0
For arrayIndex = 0 To arrayTail
midProct = proct(arrayIndex) * numIndex + carry
carry = midProct \ DIVISOR
proct(arrayIndex) = midProct - DIVISOR * carry
Next arrayIndex
Do While carry <> 0
proct(arrayIndex) = carry Mod DIVISOR
carry = carry \ DIVISOR
arrayIndex += 1
Loop
arrayTail = arrayIndex - 1
Next numIndex
热心网友
时间:2024-11-23 15:37
For
numIndex
As
Integer
=
2
To
number
carry
=
0
For
arrayIndex
=
0
To
arrayTail
midProct
=
proct(arrayIndex)
*
numIndex
+
carry
carry
=
midProct
\
DIVISOR
proct(arrayIndex)
=
midProct
-
DIVISOR
*
carry
Next
arrayIndex
Do
While
carry
<>
0
proct(arrayIndex)
=
carry
Mod
DIVISOR
carry
=
carry
\
DIVISOR
arrayIndex
+=
1
Loop
arrayTail
=
arrayIndex
-
1
Next
numIndex