主题:[活动]2^N+……2^M
神鬼天王
[专家分:30] 发布于 2009-09-15 18:33:00
快
回复列表 (共2个回复)
沙发
phile [专家分:2310] 发布于 2009-09-15 18:34:00
CLS
INPUT N, M
DIM A(500), C(500)
A(1) = 1
FOR K = N TO M
FOR I = 1 TO K
C = 0
FOR J = 1 TO 500
X = A(J) * 2 + C
C = X \ 10
A(J) = X MOD 10
NEXT J
NEXT I
L = 500
DO WHILE A(L) = 0
L = L - 1
LOOP
G = 0
FOR J = 1 TO L + 1
T = A(J) + C(J) + G
G = T \ 10
C(J) = T MOD 10
NEXT J
FOR I = 1 TO 500
A(I) = 0
NEXT I
A(1) = 1
NEXT K
S = 500
DO WHILE C(S) = 0 AND S > 1
S = S - 1
LOOP
FOR I = S TO 1 STEP -1
PRINT USING "#"; C(I);
NEXT I
板凳
phile [专家分:2310] 发布于 2009-09-15 18:34:00
高精度做的
我来回复