haihongyuan.com

# 2000年小学信息学初赛----阅读程序

2000年小学信息学初赛----阅读程序

NOIP 2000小学信息学 阅读程序 第1题

20 FOR I=1 TO 16

30 A(I)=I

40 NEXT I

50 FOR I=1 TO 3

60 J=1

65 S=1

70 FOR K=1 TO I-1

80 S=S*2

90 NEXT K

100 IF J>=16 THEN 200

110 FOR K=1 TO S

120 A(J+K-1)=A(J+K-1)+A(J+K-1+S)

130 A(J+K-1+S)=A(J+K-1)-A(J+K-1+S)

140 A(J+K-1)=A(J+K-1)-A(J+K-1+S)

150 NEXT K

160 J=J+S*2

170 GOTO 100

200 NEXT I

210 FOR I=1 TO 16

215 PRINT A(I);

220 IF I MOD 8 =0 THEN PRINT

230 NEXT I

240 END

NOIP 2000小学信息学 阅读程序 第2题

20 INPUT q, p

30 j = 1

35 p1 = 1

40 b(1) = q

45 j1 = 0

50 IF q = 0 OR p1 = 0 THEN 220

60 j1 = j1 + 1

65 C(j1) = INT(q * 10 / p)

68 q = q * 10 - C(j1) * p

70 IF q = 0 THEN 220

80 j2 = 1

90 IF (j2 > j) OR (b(j2) = q) THEN 120 100 j2 = j2 + 1

110 GOTO 90

120 IF b(j2) <> q THEN 200 130 p1 = 0

135 PRINT "0.";

140 FOR i = 1 TO j2 - 1

145 PRINT C(i);

148 NEXT i

150 PRINT "{";

160 FOR i = j2 TO j1

165 PRINT C(i);

168 NEXT i

170 PRINT "}"

180 GOTO 50

200 j = j + 1

205 b(j) = q

210 GOTO 50

220 IF q <> 0 THEN 300

230 PRINT "0.";

240 FOR i = 1 TO j1

245 PRINT C(i);

248 NEXT i

250 PRINT

300 END