主题:谁来救救我!!!!
tz6211229
[专家分:0] 发布于 2007-07-18 14:24:00
数字拆分:把原程序加入排序
回复列表 (共1个回复)
沙发
剑圣风暴 [专家分:450] 发布于 2007-07-23 08:35:00
DECLARE SUB pri ()
CLS
DIM SHARED k, total, t
INPUT k
DIM SHARED a(k)
s = 0: t = 1
DO
a(t) = a(t) + 1: s = s + a(t)
IF s >= k THEN
IF s = k THEN CALL pri
s = s - a(t): t = t - 1
IF t = 0 THEN EXIT DO
s = s - a(t)
ELSE
t = t + 1: a(t) = 0
END IF
LOOP UNTIL t = 0
PRINT "Total="; total
END
SUB pri
PRINT k; "=";
FOR i = 1 TO t - 1: PRINT a(i); "+"; : NEXT i
PRINT a(t)
total = total + 1
END SUB
我来回复