過去ログ

ゴンとも
問題文の図のアルファベットに色の代わりに数値1,3,4
を振ると隣り合うものの足し算が2,6,8を除外して
足し算が4,5,7で隣り合うものが違うものをすべて列挙して
以下のプログラム

FOR a=1 TO 4
if a=2 then goto 80
FOR b=1 TO 4
if a+b=2 or a+b=6 or a+b=8 or b=2 then goto 70
FOR c=1 TO 4
if b+c=2 or b+c=6 or b+c=8 or c=2 then goto 60
FOR d=1 TO 4
if c+d=2 or c+d=6 or c+d=8 or d=2 then goto 50
FOR e=1 TO 4
if d+e=2 or d+e=6 or d+e=8 or e=2 then goto 40
FOR f=1 TO 4
if e+f=2 or e+f=6 or e+f=8 or f=2 then goto 30
FOR g=1 TO 4
if f+g=2 or f+g=6 or f+g=8 or g=2 then goto 20
FOR h=1 TO 4
if g+h=2 or g+h=6 or g+h=8 or h+a=2 or h+a=6 or h+a=8 or h=2 then goto 10
print a;b;c;d;e;f;g;h
10 NEXT h
20 NEXT g
30 NEXT f
40 NEXT e
50 NEXT d
60 NEXT c
70 NEXT b
80 NEXT a
end
豊川市   12月4日(木) 5:38:12   MAIL:fttnm528@ybb.ne.jp   33406

過去問題一覧へ戻る