過去ログ

ゴンとも
今回の問題は東京大学の入試問題そのものだっとは驚きでした!!
京都大学の5番を十進Basic でやってみました!!

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<>24 or a+b+c+d<>10 then goto 130
for e=1 to 4
for f=1 to 4
for g=1 to 4
for h=1 to 4
IF e*f*g*h<>24 or e+f+g+h<>10 then goto 90
for i=1 to 4
for j=1 to 4
for k=1 to 4
for l=1 to 4
IF i*j*k*l<>24 or i+j+k+l<>10 then goto 50
for m=1 to 4
IF a*e*i*m<>24 or a+e+i+m<>10 then goto 40
for n=1 to 4
IF b*f*j*n<>24 or b+f+j+n<>10 then goto 30
for o=1 to 4
IF c*g*k*o<>24 or c+g+k+o<>10 then goto 20
for p=1 to 4
IF d*h*l*p<>24 or d+h+l+p<>10 then goto 10
IF m*n*o*p<>24 or m+n+o+p<>10 then goto 10
let s=s+1
10 next p
20 next o
30 next n
40 next m
50 next l
60 next k
70 next j
80 next i
90 next h
100 next g
110 next f
120 next e
130 next d
140 next c
150 next b
160 next a
print s
end

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

問題見てプログラムを書いて10分で答えがでましたが
手でやるともっとサイズの大きいラテン方陣もできるのかな-?

豊川市   2月28日(金) 9:31:13   MAIL:fttnm528@ybb.ne.jp   48819

過去問題一覧へ戻る