過去ログ

ゴンとも
十進basic で

問題文の図を

a,b,c,d
e,f,g/h
i/j/k/l

と置くと

for a=1 to 4
for b=1 to 4
for c=1 to 4
for d=1 to 4
if a+b+c+d<>10 or a*b*c*d<>24 then goto 90
for e=1 to 4
if e=a then goto 80
for f=1 to 4
if f=b then goto 70
for g=1 to 4
if g=c then goto 60
for h=1 to 4
if e+f+g+h<>10 or e*f*g*h<>24 then goto 50
if h=d then goto 50
for i=1 to 4
if i=a or i=e then goto 40
for j=1 to 4
if j=b or j=f then goto 30
for k=1 to 4
if k=c or k=g then goto 20
for l=1 to 4
if i+j+k+l<>10 or i*j*k*l<>24 then goto 10
if l=d or l=h then goto 10
let s=s+1
10 next l
20 next k
30 next j
40 next i
50 next h
60 next g
70 next f
80 next e
90 next d
100 next c
110 next b
120 next a
print s
end

f9押して 576・・・・・・(答え)

豊川市   6月26日(木) 0:26:56     41983

過去問題一覧へ戻る