主题:[活动]四色定理
神鬼天王
[专家分:30] 发布于 2009-09-28 19:08:00
用QB验证四色定理
回复列表 (共2个回复)
沙发
phile [专家分:2310] 发布于 2009-09-28 19:09:00
CLS
DIM A(100, 100), B(1000)
INPUT N
FOR I = 1 TO N
FOR J = 1 TO N
INPUT A(I, J)
NEXT J, I
FOR I = 1 TO N
FOR J = 1 TO N
PRINT USING "####"; A(I, J);
NEXT J
PRINT
NEXT I
GOSUB 100
FOR I = 1 TO N
PRINT I, B(I)
NEXT
END
100
B(1) = 1
I = 2
J = 1
DO WHILE I <= N
DO WHILE J <= 4 AND I <= N
K = 1
DO WHILE K < I AND B(K) * A(I, K) <> J
K = K + 1
LOOP
IF K < I THEN
J = J + 1
ELSE
B(I) = J
I = I + 1
J = 1
END IF
IF J > 4 THEN I = I - 1: J = B(I) + 1
LOOP
LOOP
RETURN
板凳
phile [专家分:2310] 发布于 2009-09-28 19:09:00
此题蛮难的
我来回复