過去ログ

ゴンとも
#51294
5つの分数は順不同としてfloat(267/6);44.5倍速くなりました!!
あと整数の場合だけにしました!!
十進Basic で

print time$
FOR a=1 to 10
FOR b=1 to 10
if b=a then goto 80
FOR c=a+1 TO 10
if c=a or c=b then goto 70
FOR d=1 to 10
if d=a or d=b or d=c then goto 60
FOR e=c+1 TO 10
if e=a or e=b or e=c or e=d then goto 50
FOR f=1 to 10
if f=a or f=b or f=c or f=d or f=e then goto 40
FOR g=e+1 TO 10
if g=a or g=b or g=c or g=d or g=e or g=f then goto 30
FOR h=1 to 10
if h=a or h=b or h=c or h=d or h=e or h=f or h=g then goto 20
FOR i=g+1 TO 10
if i=a or i=b or i=c or i=d or i=e or i=f or i=g or i=h then goto 10
FOR j=1 to 10
if j=a or j=b or j=c or j=d or j=e or j=f or j=g or j=h or j=i then goto 5
IF b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN let s1=s1+1
IF 2*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN let s2=s2+1
IF 3*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN let s3=s3+1
IF 4*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN let s4=s4+1
IF 5*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN let s5=s5+1
IF 6*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN let s6=s6+1
IF 7*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN let s7=s7+1
IF 8*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN LET s8=s8+1
IF 9*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN LET s9=s9+1
IF 10*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN LET s10=s10+1
IF 11*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN LET s11=s11+1
IF 12*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN LET s12=s12+1
IF 13*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN LET s13=s13+1
IF 14*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN LET s14=s14+1
IF 15*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN LET s15=s15+1
IF 16*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN LET s16=s16+1
IF 17*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN LET s17=s17+1
IF 18*b*d*f*h*j-a*d*f*h*j-b*c*f*h*j-b*d*e*h*j-b*d*f*g*j-b*d*f*h*i=0 THEN LET s18=s18+1
5 next j
10 next i
20 next h
30 next g
40 next f
50 next e
60 next d
70 next c
80 next b
90 NEXT a
PRINT s1;"+";s2;"+";s3;"+";s4;"+";s5;"+";s6;"+";s7;"+";s8;"+";s9;"+";s10;"+";s11;"+";s12;"+";s13;"+";s14;"+";s15;"+";s16;"+";s17;"+";s18;"=";s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12+s13+s14+s15+s16+s17+s18
PRINT TIME$
END

21:03:06
0 + 0 + 3 + 9 + 6 + 23 + 16 + 9 + 7 + 11 + 8 + 22 + 17 + 14 + 17 + 15 + 8 + 5 = 190
21:03:12
豊川市   2月17日(木) 21:21:23   MAIL:fttnm528@ybb.ne.jp   51303

過去問題一覧へ戻る