ベルク・カッツェ |
0 1通り
1 10通り 2 6×2×2=24で24通り 3 2×2×2=8で8通り 合計43通りになりました。 |
2月13日(木) 0:06:11
53819 |
kyorofumi |
これ3列以上あれば途端に難しくなる気がするのですが、どうなんでしょうか |
2月13日(木) 0:06:35
53820 |
みかん |
・(白白)の右の列は(白白)(白黒)(黒白)の3通り可能
・(白黒)と(黒白)の右の列は(白白)のみ可能 の2点に注意して漸化式っぽく作業しました。 黒を入れる列に注目して(最大で3列)作業してもよさそうです。 |
2月13日(木) 0:12:28
53821 |
みかん |
#53820 kyorofumiさん
・(白白白)の右列→(白白白)(白白黒)(黒白白)(白黒白)(黒白黒)の5通り可能 ・(白白黒)の右列→(白白白)(黒白白)の2通り可能 ・(黒白白)の右列→(白白白)(白白黒)の2通り可能 ・(白黒白)の右列→(白白白)のみ可能 ・(黒白黒)の右列→(白白白)のみ可能 で漸化式っぽく作業すればいいと思います。4行だと…手作業だと大変そう。 同じように作業すればいいと思うけど。 |
2月13日(木) 0:24:36
53822 |
スモークマン |
皆さん早すぎて及ばざるなり...^^;
0個・・・1通り 1・・・10 2・・・2x6+2x4+2x2・・・左から1列目 or 2列目 or 3列目1個塗り、その右側から塗れる1個を選ぶ 3・・・2^3 合計=43 通り でしたか...^^; そうか、みかんさんの漸化式っぽいアプローチはいいですね ☆ |
2月13日(木) 0:36:08
53823 |
Mr.ダンディ |
2行n列ある場合の条件を満たす場合の数を x(n)通りとすると
X(1)=3 , X(2)=5 X(n+2)=X(n+1)+2X(n) X(3)=5+6=11 X(4)=11+10=21 X(5)=21+22=43 としました。 |
茨木市
2月13日(木) 1:02:50
53824 |
「数学」小旅行 |
a(n+2)=a(n+1)+2*a(n)が成り立つと考えました |
2月13日(木) 3:44:52
53825 |
手描き図面職人 |
chatGPTにプログラムを作成してもらって、見ました。プログラムは、
from itertools import combinations def is_valid(pattern,width=5): def are_adjacent(cell1,cell2): r1,c1=divmod(cell1,width) r2,c2=divmod(cell2,width) return abs(r1-r2)<=1 and abs(c1-c2)<=1 for i,cell1 in enumerate(pattern): for cell2 in pattern[i+1:]: if are_adjacent(cell1,cell2): return False return True def count_valid_patterns(rows=2,cols=5): total_cells=rows*cols count=0 for num_black in range(total_cells+1): for pattern in combinations(range(total_cells),num_black): if is_valid(pattern,cols): count+=1 return count result=count_valid_patterns() print("Number of valid patterns:",result) chatGPTは凄いですね。 |
2月13日(木) 13:54:25
53826 |
いちごみるく |
#53820
https://wandbox.org/permlink/bUwLSRwN7dHcZpmn n=3 https://oeis.org/A054854 n=4 https://oeis.org/A054855 n=5 https://oeis.org/A063650 になるみたいです。 |
2月13日(木) 22:07:02
53827 |
ゴンとも |
十進Basicで
for a=0 to 1 for b=0 to 1 if a=1 and b=1 then goto 90 for c=0 to 1 if b=1 and c=1 then goto 80 for d=0 to 1 if c=1 and d=1 then goto 70 for e=0 to 1 if d=1 and e=1 then goto 60 for f=0 to 1 if (a=1 and f=1) or (b=1 and f=1) then goto 50 for g=0 to 1 if (a=1 and g=1) or (b=1 and g=1) or (f=1 and g=1) or (c=1 and g=1) then goto 40 for h=0 to 1 if (b=1 and h=1) or (c=1 and h=1) or (g=1 and h=1) or (d=1 and h=1) then goto 30 for i=0 to 1 if (c=1 and i=1) or (d=1 and i=1) or (h=1 and i=1) or (e=1 and i=1) then goto 20 for j=0 to 1 if (d=1 and j=1) or (e=1 and j=1) or (i=1 and j=1) then goto 10 let s=s+1 10 next j 20 next i 30 next h 40 next g 50 next f 60 next e 70 next d 80 next c 90 next b 100 next a print s end f9押して 43・・・・・・(答え) |
豊川市
2月14日(金) 6:42:13
53828 |
「数学」小旅行 |
例によって、Rubyプログラムです。再帰関数を使います。
$n=0 def r(i) if i>=10 then $n+=1 else r(i+3+(i+1)%2) r(i+1) end end r(0) p $n |
2月14日(金) 10:54:53
53829 |
「数学」小旅行 |
先のプログラムをパイソンで書くと以下のように(グローバル変数に注意)
global N N=0 def r(i): global N if i>=11: N+=1 else: r(i+3+i%2) r(i+1) r(1) print(N) |
2月14日(金) 12:32:56
53830 |
「数学」小旅行 |
総当たりで調べる方法です。
塗ったところの周りには塗ったところがないという塗り方を数える方法です。 Rubyのワンライナーにしました。 p [0,1].repeated_permutation(10).count{|x|(0..9).map{|i|x[i]==1?((((j=i-2-i%2)>=0?j:0)..((j+5)<=9?j+5:9)).map{|k|x[k]}.sum-1):0}.sum==0} |
2月14日(金) 16:19:09
53831 |
kyorofumi |
漸化式のアプローチがあるのかなるほど、
#53827 1x1と2x2のタイルで埋める場合の数と今回の塗りつぶしの場合の数が同じになるのはなぜなんでしょうか? |
2月17日(月) 19:30:06
53832 |
いちごみるく |
#53832
n*mの盤を上下左右ともに0.5拡げた (n+1)*(m+1)の盤を 2*2の白正方形の中心に1*1の黒正方形が描かれた図形と1*1の白正方形で敷き詰めることを考えると 同じ問題になるので |
2月18日(火) 0:11:02
53833 |
kyorofumi |
なるほど、これはすばらしく美しい命題の置き換えですね。。。 |
2月18日(火) 22:10:26
53834 |