٥륯åĥ
ƤߤƤϤޤΤ4̤ꡣ
ƤϤƤߤ顢3̤Բǽ
Ĥ1̤ˤĤƤοƤϤ2̤ꡣ
2̤ˤʤޤ
⿲­ʤΤǤ⤦ޤ
825ڡ 0:43:50 51776
ֿء׾ι
Ƥߤ뤷ϤʤΤ
ޤ

֤󡢺ǤⲼʥץǤ
a=[]
a[1]=[[1,1],[2,2],[3,3],[4,4]]
a[2]=(1..4).to_a.permutation(2).to_a.permutation(4).to_a.select{|x|x[0][0]==2&&[x[0][0],x[1][0],x[2][0],x[3][0]].uniq.count==4&&[x[0][1],x[1][1],x[2][1],x[3][1]].uniq.count==4}.to_a
a[3]=(1..4).to_a.permutation(2).to_a.permutation(4).to_a.select{|x|x[0][0]==3&&[x[0][0],x[1][0],x[2][0],x[3][0]].uniq.count==4&&[x[0][1],x[1][1],x[2][1],x[3][1]].uniq.count==4}.to_a
a[4]=(1..4).to_a.permutation(2).to_a.permutation(4).to_a.select{|x|x[0][0]==4&&[x[0][0],x[1][0],x[2][0],x[3][0]].uniq.count==4&&[x[0][1],x[1][1],x[2][1],x[3][1]].uniq.count==4}.to_a

for i in (0..a[2].count-1)
for j in (0..a[3].count-1)
for k in (0..a[4].count-1)

if [a[1][0][1],a[2][i][0][1],a[3][j][0][1],a[4][k][0][1]].uniq.count==4 &&
[a[1][1][0],a[2][i][1][0],a[3][j][1][0],a[4][k][1][0]].uniq.count==4 &&
[a[1][1][1],a[2][i][1][1],a[3][j][1][1],a[4][k][1][1]].uniq.count==4 &&
[a[1][2][0],a[2][i][2][0],a[3][j][2][0],a[4][k][2][0]].uniq.count==4 &&
[a[1][2][1],a[2][i][2][1],a[3][j][2][1],a[4][k][2][1]].uniq.count==4 &&
[a[1][3][0],a[2][i][3][0],a[3][j][3][0],a[4][k][3][0]].uniq.count==4 &&
[a[1][3][1],a[2][i][3][1],a[3][j][3][1],a[4][k][3][1]].uniq.count==4 &&
(a[1]+a[2][i]+a[3][j]+a[4][k]).uniq.count==16
then
p ''
p a[1]
p a[2][i]
p a[3][j]
p a[4][k]
end
end
end
end

Τʤǡ(a[1]+a[2][i]+a[3][j]+a[4][k]).uniq.count==16
ǰƤơ8̤տƤޤ

825ڡ 13:34:00 51777
ֿء׾ι
Ƥߤ뤷ϤʤΤ
ޤ

֤󡢺ǤⲼʥץǤ
a=[]
a[1]=[[1,1],[2,2],[3,3],[4,4]]
a[2]=(1..4).to_a.permutation(2).to_a.permutation(4).to_a.select{|x|x[0][0]==2&&[x[0][0],x[1][0],x[2][0],x[3][0]].uniq.count==4&&[x[0][1],x[1][1],x[2][1],x[3][1]].uniq.count==4}.to_a
a[3]=(1..4).to_a.permutation(2).to_a.permutation(4).to_a.select{|x|x[0][0]==3&&[x[0][0],x[1][0],x[2][0],x[3][0]].uniq.count==4&&[x[0][1],x[1][1],x[2][1],x[3][1]].uniq.count==4}.to_a
a[4]=(1..4).to_a.permutation(2).to_a.permutation(4).to_a.select{|x|x[0][0]==4&&[x[0][0],x[1][0],x[2][0],x[3][0]].uniq.count==4&&[x[0][1],x[1][1],x[2][1],x[3][1]].uniq.count==4}.to_a

for i in (0..a[2].count-1)
for j in (0..a[3].count-1)
for k in (0..a[4].count-1)

if [a[1][0][1],a[2][i][0][1],a[3][j][0][1],a[4][k][0][1]].uniq.count==4 &&
[a[1][1][0],a[2][i][1][0],a[3][j][1][0],a[4][k][1][0]].uniq.count==4 &&
[a[1][1][1],a[2][i][1][1],a[3][j][1][1],a[4][k][1][1]].uniq.count==4 &&
[a[1][2][0],a[2][i][2][0],a[3][j][2][0],a[4][k][2][0]].uniq.count==4 &&
[a[1][2][1],a[2][i][2][1],a[3][j][2][1],a[4][k][2][1]].uniq.count==4 &&
[a[1][3][0],a[2][i][3][0],a[3][j][3][0],a[4][k][3][0]].uniq.count==4 &&
[a[1][3][1],a[2][i][3][1],a[3][j][3][1],a[4][k][3][1]].uniq.count==4 &&
(a[1]+a[2][i]+a[3][j]+a[4][k]).uniq.count==16
then
p ''
p a[1]
p a[2][i]
p a[3][j]
p a[4][k]
end
end
end
end

Τʤǡ(a[1]+a[2][i]+a[3][j]+a[4][k]).uniq.count==16
ǰƤơ8̤տƤޤ

825ڡ 13:34:00 51778
ֿء׾ι
Ƥߤ뤷ϤʤΤ
ޤ

֤󡢺ǤⲼʥץǤ
a=[]
a[1]=[[1,1],[2,2],[3,3],[4,4]]
a[2]=(1..4).to_a.permutation(2).to_a.permutation(4).to_a.select{|x|x[0][0]==2&&[x[0][0],x[1][0],x[2][0],x[3][0]].uniq.count==4&&[x[0][1],x[1][1],x[2][1],x[3][1]].uniq.count==4}.to_a
a[3]=(1..4).to_a.permutation(2).to_a.permutation(4).to_a.select{|x|x[0][0]==3&&[x[0][0],x[1][0],x[2][0],x[3][0]].uniq.count==4&&[x[0][1],x[1][1],x[2][1],x[3][1]].uniq.count==4}.to_a
a[4]=(1..4).to_a.permutation(2).to_a.permutation(4).to_a.select{|x|x[0][0]==4&&[x[0][0],x[1][0],x[2][0],x[3][0]].uniq.count==4&&[x[0][1],x[1][1],x[2][1],x[3][1]].uniq.count==4}.to_a

for i in (0..a[2].count-1)
for j in (0..a[3].count-1)
for k in (0..a[4].count-1)

if [a[1][0][1],a[2][i][0][1],a[3][j][0][1],a[4][k][0][1]].uniq.count==4 &&
[a[1][1][0],a[2][i][1][0],a[3][j][1][0],a[4][k][1][0]].uniq.count==4 &&
[a[1][1][1],a[2][i][1][1],a[3][j][1][1],a[4][k][1][1]].uniq.count==4 &&
[a[1][2][0],a[2][i][2][0],a[3][j][2][0],a[4][k][2][0]].uniq.count==4 &&
[a[1][2][1],a[2][i][2][1],a[3][j][2][1],a[4][k][2][1]].uniq.count==4 &&
[a[1][3][0],a[2][i][3][0],a[3][j][3][0],a[4][k][3][0]].uniq.count==4 &&
[a[1][3][1],a[2][i][3][1],a[3][j][3][1],a[4][k][3][1]].uniq.count==4 &&
(a[1]+a[2][i]+a[3][j]+a[4][k]).uniq.count==16
then
p ''
p a[1]
p a[2][i]
p a[3][j]
p a[4][k]
end
end
end
end

Τʤǡ(a[1]+a[2][i]+a[3][j]+a[4][k]).uniq.count==16
ǰƤơ8̤տƤޤ

825ڡ 13:34:01 51779
ֿء׾ι
ΤޥĴҤѤǡ󥯥å꡼åˤʤäߤǤѤ줷Ȥˤʤޤޤ
825ڡ 14:29:14 51780
ޤ륱
ȥפΣ¤٤ƻԺȻפäɥȥפĤ餺
ʻҤˣΥڥǿ񤤤ƻԺ
äȤꤽʤΤˣ̤ꤷʤΤäơäȤäǤ

̣̤ܰǰ̲
ξϤ֤ʤΤǣ̤ꡣ
Ȳʤ
ȣ̤ꡣ
ǺΣϣ̤ꡣ
rubyǸΤ¤ơ礭ʿǡ
ϣ̤ꡣ
ϲʤ
ϲ򡢡ΤǤޤڤƤޤ

ޥ뤵οꡢѤ餺̯Ǥ͡
ä餪夲Ǥ
826ʶ 19:09:57 MAIL:take4310@mobile.email.ne.jp 51781
ޤ륱
ߤĤ֤ʥ르ꥺȡդƤڤƤޤǤ
Ȥꤢ1000̤ʾϤ뤳Ȥ𤤤ޤ
827ڡ 7:42:48 MAIL:take4310@mobile.email.ne.jp 51782
ߤ뤯
ͤƤ6912ˤʤȻפäޤ
91ڡ 0:29:33 51783
ޤ륱
#51783
֤ĹΤǡ롼룵롼룶򳰤ͤƤޤ
١˵ջȡ
롼룵Τξ򳰤ȣܡ
¤Ӥξ⳰Ȥˣܡ
롼룶ĤΣܤοʣܤġˤν֤ѤƤˣܡ
ߣߣߣƱФޤ
92ʶ 18:00:43 MAIL:take4310@mobile.email.ne.jp 51784

4ˡɽ0033ȤäؤĤ

롼ꡢƹԡˤϰΰ̤Ȼͤΰ̤
03ޤǤο1Ĥ

00 11 22 33
x1
x2
x3
ޤdz

2̤ꤷʤȤϤˤ狼Τǡ
줾ξͤ

00 11 22 33
21
32
13

ޤԤˤĤƹͤ

ΰ̤3Ǥ1333ȤƤΤǡ
0323ʤƱԤ21ޤΤǡ03ʤ

Ʊͤˡΰ̤2Ǥ0212ʤ
ƱԤ03ޤळȤ顢12ȷޤ

äơĤ1Ĥ30Ǥ

ˡޤˤĤƤƱͤ˹ͤȡ
022330ޤळȤ狼

ꡢ30ȷޤꡢ
1̤ޤ뤳Ȥ񤷤ʤ

00 11 22 33
31
12
23
ˤĤƤƱ

ʾꡢ2̤

ʤɤȹͤƤߤΤΡ
ä˴ñˤʤäƤ櫓Ǥʤ
94 19:52:48 51785
ֿء׾ι
ˤ⡢ʥץβץäΤǤƹͤޤ

$n=9
$n2=$n**2
$a=[0,2,0,0,0,0,0,7,0,
1,9,0,5,0,7,0,3,8,
3,0,0,0,6,0,0,0,1,
0,8,0,3,0,9,0,2,0,
0,0,0,0,0,0,0,0,0,
0,4,0,0,0,0,0,6,0,
0,5,0,1,8,3,0,9,0,
0,0,0,0,0,0,0,0,0,
7,0,8,0,0,0,4,0,5]#ǡäƤʤȤϣˤޤ

def s(k)
r=(k/3%3)*3+(k/9/3)*27
if k<$n2 then
if $a[k]==0 then
for m in 1..$n
t=false
t=t||(m==$a[r])||(m==$a[r+1])||(m==$a[r+2])||(m==$a[r+9])||(m==$a[r+10])||
(m==$a[r+11])||(m==$a[r+18])||(m==$a[r+19])||(m==$a[r+20])
if !t then
for i in (0..$n-1)
t=t||(m==$a[k/$n*$n+i])||(m==$a[i*$n+k%$n])
end
end
if !t then
$a[k]=m;s(k+1);$a[k]=0
end
end
else
s(k+1)
end
else
p $a
end
end

#ƵƤӽФDz򤬸ĤäϤޤ
s(0)
95ʷ 9:51:16 51786
ֿء׾ι
롼룵ʤä顢ǡ
29ܤΥɥ쥹ϤкΤǤ

$n=4
$n2=$n**2
a=Array.new($n**2,0)
b=Array.new($n**2,0)#ʤˤ
as=Array.new()
bs=Array.new()

def e(h,k,m) #kܤm뤫True or False
t=false
for i in (0..$n-1)
t=t||(m==h[k/$n*$n+i])
t=t||(m==h[i*$n+k%$n])
end
t
end

def s(h,k,l)
if k<$n2 then
if h[k]==0 then
for m in 1..$n
if !e(h,k,m) then
h[k]=m;s(h,k+1,l);h[k]=0
end
end
else
s(h,k+1,l)
end
else
buf=h.map{|x|x}#ɥ쥹Ϥк
l.push(buf)
$c+=1
end
end

ti=Time.now
$c=0#٤Ƥas¸
s(a,0,as)
ac=$c

$c=0#դ٤Ƥbs¸
s(b,0,bs)
bc=$c

$c=0
for i in 0..ac-1#ֹΥåȤ٤ưۤʤΤ
for j in 0..bc-1
if [as[i],bs[j]].transpose.uniq.count==$n2 then
$c+=1
end
end
end

p $c
p Time.now-ti
95ʷ 16:08:38 51787