|
ベルク・カッツェ |
|
全部横なのが2×2×2=8通り
2本縦が4×2×2=16通り 4本縦で同じ段なのが2×2=4通り 4本縦で段がずれているのが4通り 全部で32通りになりました。 |
|
9月9日(木) 0:09:01
50817 |
|
いちごみるく |
|
2*2*nで何通りになるでしょうか
n <= 10^12 通り数は巨大になりうるので998244353で割ったあまりで答えてください。 みたいな問題を考えてみます。 |
|
9月9日(木) 0:14:24
50818 |
|
今年から高齢者 |
|
高さ方向を3段に区切って。下から�´↓�とする
�´↓�とも横の場合が、2^2=8 �,浪�(2とおり)で、�↓�を縦にする。2本ずつ縦が4、4本縦が1。全部で、2*(4+1)=10 ��が横(2とおり)で、�´△鮟弔砲垢襦�2本ずつ縦が4、4本縦が1。全部で、2*(4+1)=10 �,�1本と��の反対側の1本が横で、残りは縦で、4 全部で、8+10+10+4=32とおり |
|
9月9日(木) 0:27:37
50820 |
|
pnae |
| #50818 3x3行列の累乗に{1,0,0}をかけることに帰着できそうなので、そのようにして解けると思います |
|
9月9日(木) 0:28:24
50821 |
|
紫の薔薇の人 |
|
縦を使わない場合、2*2*2=8通り。
1段目に縦を使わないで、2段目-3段目に縦を使う場合 1段目の置き方が2通り 縦を2本使う場合が4通り、縦を4本使う場合が1通り 2*(4+1)=10通り。 同様に、 3段目に縦を使わないで、1段目-2段目に縦を使う場合 10通り。 最後に 1段目-2段目、2段目-3段目に縦を使う場合 4通り 計32通り // |
|
9月9日(木) 0:29:57
50822 |
|
いちごみるく |
|
#50821
そうですね。 なんかいい感じに難易度調整できないですかね。 |
|
9月9日(木) 0:35:07
50823 |
|
いちごみるく |
|
というかこれですね
https://oeis.org/A006253 |
|
9月9日(木) 0:42:23
50824 |
|
Jママ |
|
大きい立体の3✕2の面を底面として考え直し、
小さい立体を立てる所は✕を0,2,4,6個書きながら、上下二段で違う置き方がある場合や、 対称性のあるものは重複させて足し算しました。 例によってお目汚しの手書き画像ですが https://d.kuku.lu/05b56e78f |
|
9月9日(木) 1:24:05
50825 |
|
Jママ |
| 文字化けは、「3かける2」と、「バツ印」の事です |
|
9月9日(木) 1:25:49
50826 |
|
ゴンとも |
|
容器に直方体xは20箇所置けるが
1から20まで番号を振り被らないようにして 十進Basic で print time$ for a=1 to 20 for b=1 to 20 if b=a then goto 50 if a=1 and (b=3 or b=4 or b=13 or b=16) then goto 50 if a=2 and (b=3 or b=4 or b=14 or b=15) then goto 50 if a=3 and (b=1 or b=2 or b=13 or b=14) then goto 50 if a=4 and (b=1 or b=2 or b=15 or b=16) then goto 50 if a=5 and (b=7 or b=8 or b=13 or b=16 or b=17 or b=20) then goto 50 if a=6 and (b=7 or b=8 or b=14 or b=15 or b=18 or b=19) then goto 50 if a=7 and (b=5 or b=6 or b=13 or b=14 or b=17 or b=18) then goto 50 if a=8 and (b=5 or b=6 or b=15 or b=16 or b=19 or b=20) then goto 50 if a=9 and (b=11 or b=12 or b=17 or b=20) then goto 50 if a=10 and (b=11 or b=12 or b=18 or b=19) then goto 50 if a=11 and (b=9 or b=10 or b=17 or b=18) then goto 50 if a=12 and (b=9 or b=10 or b=19 or b=20) then goto 50 if a=13 and (b=1 or b=3 or b=5 or b=7 or b=17) then goto 50 if a=14 and (b=2 or b=3 or b=6 or b=7 or b=18) then goto 50 if a=15 and (b=2 or b=4 or b=6 or b=8 or b=19) then goto 50 if a=16 and (b=1 or b=4 or b=5 or b=8 or b=20) then goto 50 if a=17 and (b=5 or b=7 or b=9 or b=11 or b=13) then goto 50 if a=18 and (b=6 or b=7 or b=10 or b=11 or b=14) then goto 50 if a=19 and (b=6 or b=8 or b=10 or b=12 or b=15) then goto 50 if a=20 and (b=5 or b=8 or b=9 or b=12 or b=16) then goto 50 for c=1 to 20 if c=a or c=b then goto 40 if a=1 and (c=3 or c=4 or c=13 or c=16) then goto 40 if a=2 and (c=3 or c=4 or c=14 or c=15) then goto 40 if a=3 and (c=1 or c=2 or c=13 or c=14) then goto 40 if a=4 and (c=1 or c=2 or c=15 or c=16) then goto 40 if a=5 and (c=7 or c=8 or c=13 or c=16 or c=17 or c=20) then goto 40 if a=6 and (c=7 or c=8 or c=14 or c=15 or c=18 or c=19) then goto 40 if a=7 and (c=5 or c=6 or c=13 or c=14 or c=17 or c=18) then goto 40 if a=8 and (c=5 or c=6 or c=15 or c=16 or c=19 or c=20) then goto 40 if a=9 and (c=11 or c=12 or c=17 or c=20) then goto 40 if a=10 and (c=11 or c=12 or c=18 or c=19) then goto 40 if a=11 and (c=9 or c=10 or c=17 or c=18) then goto 40 if a=12 and (c=9 or c=10 or c=19 or c=20) then goto 40 if a=13 and (c=1 or c=3 or c=5 or c=7 or c=17) then goto 40 if a=14 and (c=2 or c=3 or c=6 or c=7 or c=18) then goto 40 if a=15 and (c=2 or c=4 or c=6 or c=8 or c=19) then goto 40 if a=16 and (c=1 or c=4 or c=5 or c=8 or c=20) then goto 40 if a=17 and (c=5 or c=7 or c=9 or c=11 or c=13) then goto 40 if a=18 and (c=6 or c=7 or c=10 or c=11 or c=14) then goto 40 if a=19 and (c=6 or c=8 or c=10 or c=12 or c=15) then goto 40 if a=20 and (c=5 or c=8 or c=9 or c=12 or c=16) then goto 40 if b=1 and (c=3 or c=4 or c=13 or c=16) then goto 40 if b=2 and (c=3 or c=4 or c=14 or c=15) then goto 40 if b=3 and (c=1 or c=2 or c=13 or c=14) then goto 40 if b=4 and (c=1 or c=2 or c=15 or c=16) then goto 40 if b=5 and (c=7 or c=8 or c=13 or c=16 or c=17 or c=20) then goto 40 if b=6 and (c=7 or c=8 or c=14 or c=15 or c=18 or c=19) then goto 40 if b=7 and (c=5 or c=6 or c=13 or c=14 or c=17 or c=18) then goto 40 if b=8 and (c=5 or c=6 or c=15 or c=16 or c=19 or c=20) then goto 40 if b=9 and (c=11 or c=12 or c=17 or c=20) then goto 40 if b=10 and (c=11 or c=12 or c=18 or c=19) then goto 40 if b=11 and (c=9 or c=10 or c=17 or c=18) then goto 40 if b=12 and (c=9 or c=10 or c=19 or c=20) then goto 40 if b=13 and (c=1 or c=3 or c=5 or c=7 or c=17) then goto 40 if b=14 and (c=2 or c=3 or c=6 or c=7 or c=18) then goto 40 if b=15 and (c=2 or c=4 or c=6 or c=8 or c=19) then goto 40 if b=16 and (c=1 or c=4 or c=5 or c=8 or c=20) then goto 40 if b=17 and (c=5 or c=7 or c=9 or c=11 or c=13) then goto 40 if b=18 and (c=6 or c=7 or c=10 or c=11 or c=14) then goto 40 if b=19 and (c=6 or c=8 or c=10 or c=12 or c=15) then goto 40 if b=20 and (c=5 or c=8 or c=9 or c=12 or c=16) then goto 40 for d=1 to 20 if d=a or d=b or d=c then goto 30 if a=1 and (d=3 or d=4 or d=13 or d=16) then goto 30 if a=2 and (d=3 or d=4 or d=14 or d=15) then goto 30 if a=3 and (d=1 or d=2 or d=13 or d=14) then goto 30 if a=4 and (d=1 or d=2 or d=15 or d=16) then goto 30 if a=5 and (d=7 or d=8 or d=13 or d=16 or d=17 or d=20) then goto 30 if a=6 and (d=7 or d=8 or d=14 or d=15 or d=18 or d=19) then goto 30 if a=7 and (d=5 or d=6 or d=13 or d=14 or d=17 or d=18) then goto 30 if a=8 and (d=5 or d=6 or d=15 or d=16 or d=19 or d=20) then goto 30 if a=9 and (d=11 or d=12 or d=17 or d=20) then goto 30 if a=10 and (d=11 or d=12 or d=18 or d=19) then goto 30 if a=11 and (d=9 or d=10 or d=17 or d=18) then goto 30 if a=12 and (d=9 or d=10 or d=19 or d=20) then goto 30 if a=13 and (d=1 or d=3 or d=5 or d=7 or d=17) then goto 30 if a=14 and (d=2 or d=3 or d=6 or d=7 or d=18) then goto 30 if a=15 and (d=2 or d=4 or d=6 or d=8 or d=19) then goto 30 if a=16 and (d=1 or d=4 or d=5 or d=8 or d=20) then goto 30 if a=17 and (d=5 or d=7 or d=9 or d=11 or d=13) then goto 30 if a=18 and (d=6 or d=7 or d=10 or d=11 or d=14) then goto 30 if a=19 and (d=6 or d=8 or d=10 or d=12 or d=15) then goto 30 if a=20 and (d=5 or d=8 or d=9 or d=12 or d=16) then goto 30 if b=1 and (d=3 or d=4 or d=13 or d=16) then goto 30 if b=2 and (d=3 or d=4 or d=14 or d=15) then goto 30 if b=3 and (d=1 or d=2 or d=13 or d=14) then goto 30 if b=4 and (d=1 or d=2 or d=15 or d=16) then goto 30 if b=5 and (d=7 or d=8 or d=13 or d=16 or d=17 or d=20) then goto 30 if b=6 and (d=7 or d=8 or d=14 or d=15 or d=18 or d=19) then goto 30 if b=7 and (d=5 or d=6 or d=13 or d=14 or d=17 or d=18) then goto 30 if b=8 and (d=5 or d=6 or d=15 or d=16 or d=19 or d=20) then goto 30 if b=9 and (d=11 or d=12 or d=17 or d=20) then goto 30 if b=10 and (d=11 or d=12 or d=18 or d=19) then goto 30 if b=11 and (d=9 or d=10 or d=17 or d=18) then goto 30 if b=12 and (d=9 or d=10 or d=19 or d=20) then goto 30 if b=13 and (d=1 or d=3 or d=5 or d=7 or d=17) then goto 30 if b=14 and (d=2 or d=3 or d=6 or d=7 or d=18) then goto 30 if b=15 and (d=2 or d=4 or d=6 or d=8 or d=19) then goto 30 if b=16 and (d=1 or d=4 or d=5 or d=8 or d=20) then goto 30 if b=17 and (d=5 or d=7 or d=9 or d=11 or d=13) then goto 30 if b=18 and (d=6 or d=7 or d=10 or d=11 or d=14) then goto 30 if b=19 and (d=6 or d=8 or d=10 or d=12 or d=15) then goto 30 if b=20 and (d=5 or d=8 or d=9 or d=12 or d=16) then goto 30 if c=1 and (d=3 or d=4 or d=13 or d=16) then goto 30 if c=2 and (d=3 or d=4 or d=14 or d=15) then goto 30 if c=3 and (d=1 or d=2 or d=13 or d=14) then goto 30 if c=4 and (d=1 or d=2 or d=15 or d=16) then goto 30 if c=5 and (d=7 or d=8 or d=13 or d=16 or d=17 or d=20) then goto 30 if c=6 and (d=7 or d=8 or d=14 or d=15 or d=18 or d=19) then goto 30 if c=7 and (d=5 or d=6 or d=13 or d=14 or d=17 or d=18) then goto 30 if c=8 and (d=5 or d=6 or d=15 or d=16 or d=19 or d=20) then goto 30 if c=9 and (d=11 or d=12 or d=17 or d=20) then goto 30 if c=10 and (d=11 or d=12 or d=18 or d=19) then goto 30 if c=11 and (d=9 or d=10 or d=17 or d=18) then goto 30 if c=12 and (d=9 or d=10 or d=19 or d=20) then goto 30 if c=13 and (d=1 or d=3 or d=5 or d=7 or d=17) then goto 30 if c=14 and (d=2 or d=3 or d=6 or d=7 or d=18) then goto 30 if c=15 and (d=2 or d=4 or d=6 or d=8 or d=19) then goto 30 if c=16 and (d=1 or d=4 or d=5 or d=8 or d=20) then goto 30 if c=17 and (d=5 or d=7 or d=9 or d=11 or d=13) then goto 30 if c=18 and (d=6 or d=7 or d=10 or d=11 or d=14) then goto 30 if c=19 and (d=6 or d=8 or d=10 or d=12 or d=15) then goto 30 if c=20 and (d=5 or d=8 or d=9 or d=12 or d=16) then goto 30 for e=1 to 20 if e=a or e=b or e=c or e=d then goto 20 if a=1 and (e=3 or e=4 or e=13 or e=16) then goto 20 if a=2 and (e=3 or e=4 or e=14 or e=15) then goto 20 if a=3 and (e=1 or e=2 or e=13 or e=14) then goto 20 if a=4 and (e=1 or e=2 or e=15 or e=16) then goto 20 if a=5 and (e=7 or e=8 or e=13 or e=16 or e=17 or e=20) then goto 20 if a=6 and (e=7 or e=8 or e=14 or e=15 or e=18 or e=19) then goto 20 if a=7 and (e=5 or e=6 or e=13 or e=14 or e=17 or e=18) then goto 20 if a=8 and (e=5 or e=6 or e=15 or e=16 or e=19 or e=20) then goto 20 if a=9 and (e=11 or e=12 or e=17 or e=20) then goto 20 if a=10 and (e=11 or e=12 or e=18 or e=19) then goto 20 if a=11 and (e=9 or e=10 or e=17 or e=18) then goto 20 if a=12 and (e=9 or e=10 or e=19 or e=20) then goto 20 if a=13 and (e=1 or e=3 or e=5 or e=7 or e=17) then goto 20 if a=14 and (e=2 or e=3 or e=6 or e=7 or e=18) then goto 20 if a=15 and (e=2 or e=4 or e=6 or e=8 or e=19) then goto 20 if a=16 and (e=1 or e=4 or e=5 or e=8 or e=20) then goto 20 if a=17 and (e=5 or e=7 or e=9 or e=11 or e=13) then goto 20 if a=18 and (e=6 or e=7 or e=10 or e=11 or e=14) then goto 20 if a=19 and (e=6 or e=8 or e=10 or e=12 or e=15) then goto 20 if a=20 and (e=5 or e=8 or e=9 or e=12 or e=16) then goto 20 if b=1 and (e=3 or e=4 or e=13 or e=16) then goto 20 if b=2 and (e=3 or e=4 or e=14 or e=15) then goto 20 if b=3 and (e=1 or e=2 or e=13 or e=14) then goto 20 if b=4 and (e=1 or e=2 or e=15 or e=16) then goto 20 if b=5 and (e=7 or e=8 or e=13 or e=16 or e=17 or e=20) then goto 20 if b=6 and (e=7 or e=8 or e=14 or e=15 or e=18 or e=19) then goto 20 if b=7 and (e=5 or e=6 or e=13 or e=14 or e=17 or e=18) then goto 20 if b=8 and (e=5 or e=6 or e=15 or e=16 or e=19 or e=20) then goto 20 if b=9 and (e=11 or e=12 or e=17 or e=20) then goto 20 if b=10 and (e=11 or e=12 or e=18 or e=19) then goto 20 if b=11 and (e=9 or e=10 or e=17 or e=18) then goto 20 if b=12 and (e=9 or e=10 or e=19 or e=20) then goto 20 if b=13 and (e=1 or e=3 or e=5 or e=7 or e=17) then goto 20 if b=14 and (e=2 or e=3 or e=6 or e=7 or e=18) then goto 20 if b=15 and (e=2 or e=4 or e=6 or e=8 or e=19) then goto 20 if b=16 and (e=1 or e=4 or e=5 or e=8 or e=20) then goto 20 if b=17 and (e=5 or e=7 or e=9 or e=11 or e=13) then goto 20 if b=18 and (e=6 or e=7 or e=10 or e=11 or e=14) then goto 20 if b=19 and (e=6 or e=8 or e=10 or e=12 or e=15) then goto 20 if b=20 and (e=5 or e=8 or e=9 or e=12 or e=16) then goto 20 if c=1 and (e=3 or e=4 or e=13 or e=16) then goto 20 if c=2 and (e=3 or e=4 or e=14 or e=15) then goto 20 if c=3 and (e=1 or e=2 or e=13 or e=14) then goto 20 if c=4 and (e=1 or e=2 or e=15 or e=16) then goto 20 if c=5 and (e=7 or e=8 or e=13 or e=16 or e=17 or e=20) then goto 20 if c=6 and (e=7 or e=8 or e=14 or e=15 or e=18 or e=19) then goto 20 if c=7 and (e=5 or e=6 or e=13 or e=14 or e=17 or e=18) then goto 20 if c=8 and (e=5 or e=6 or e=15 or e=16 or e=19 or e=20) then goto 20 if c=9 and (e=11 or e=12 or e=17 or e=20) then goto 20 if c=10 and (e=11 or e=12 or e=18 or e=19) then goto 20 if c=11 and (e=9 or e=10 or e=17 or e=18) then goto 20 if c=12 and (e=9 or e=10 or e=19 or e=20) then goto 20 if c=13 and (e=1 or e=3 or e=5 or e=7 or e=17) then goto 20 if c=14 and (e=2 or e=3 or e=6 or e=7 or e=18) then goto 20 if c=15 and (e=2 or e=4 or e=6 or e=8 or e=19) then goto 20 if c=16 and (e=1 or e=4 or e=5 or e=8 or e=20) then goto 20 if c=17 and (e=5 or e=7 or e=9 or e=11 or e=13) then goto 20 if c=18 and (e=6 or e=7 or e=10 or e=11 or e=14) then goto 20 if c=19 and (e=6 or e=8 or e=10 or e=12 or e=15) then goto 20 if c=20 and (e=5 or e=8 or e=9 or e=12 or e=16) then goto 20 if d=1 and (e=3 or e=4 or e=13 or e=16) then goto 20 if d=2 and (e=3 or e=4 or e=14 or e=15) then goto 20 if d=3 and (e=1 or e=2 or e=13 or e=14) then goto 20 if d=4 and (e=1 or e=2 or e=15 or e=16) then goto 20 if d=5 and (e=7 or e=8 or e=13 or e=16 or e=17 or e=20) then goto 20 if d=6 and (e=7 or e=8 or e=14 or e=15 or e=18 or e=19) then goto 20 if d=7 and (e=5 or e=6 or e=13 or e=14 or e=17 or e=18) then goto 20 if d=8 and (e=5 or e=6 or e=15 or e=16 or e=19 or e=20) then goto 20 if d=9 and (e=11 or e=12 or e=17 or e=20) then goto 20 if d=10 and (e=11 or e=12 or e=18 or e=19) then goto 20 if d=11 and (e=9 or e=10 or e=17 or e=18) then goto 20 if d=12 and (e=9 or e=10 or e=19 or e=20) then goto 20 if d=13 and (e=1 or e=3 or e=5 or e=7 or e=17) then goto 20 if d=14 and (e=2 or e=3 or e=6 or e=7 or e=18) then goto 20 if d=15 and (e=2 or e=4 or e=6 or e=8 or e=19) then goto 20 if d=16 and (e=1 or e=4 or e=5 or e=8 or e=20) then goto 20 if d=17 and (e=5 or e=7 or e=9 or e=11 or e=13) then goto 20 if d=18 and (e=6 or e=7 or e=10 or e=11 or e=14) then goto 20 if d=19 and (e=6 or e=8 or e=10 or e=12 or e=15) then goto 20 if d=20 and (e=5 or e=8 or e=9 or e=12 or e=16) then goto 20 for f=1 to 20 if f=a or f=b or f=c or f=d or f=e then goto 10 if a=1 and (f=3 or f=4 or f=13 or f=16) then goto 10 if a=2 and (f=3 or f=4 or f=14 or f=15) then goto 10 if a=3 and (f=1 or f=2 or f=13 or f=14) then goto 10 if a=4 and (f=1 or f=2 or f=15 or f=16) then goto 10 if a=5 and (f=7 or f=8 or f=13 or f=16 or f=17 or f=20) then goto 10 if a=6 and (f=7 or f=8 or f=14 or f=15 or f=18 or f=19) then goto 10 if a=7 and (f=5 or f=6 or f=13 or f=14 or f=17 or f=18) then goto 10 if a=8 and (f=5 or f=6 or f=15 or f=16 or f=19 or f=20) then goto 10 if a=9 and (f=11 or f=12 or f=17 or f=20) then goto 10 if a=10 and (f=11 or f=12 or f=18 or f=19) then goto 10 if a=11 and (f=9 or f=10 or f=17 or f=18) then goto 10 if a=12 and (f=9 or f=10 or f=19 or f=20) then goto 10 if a=13 and (f=1 or f=3 or f=5 or f=7 or f=17) then goto 10 if a=14 and (f=2 or f=3 or f=6 or f=7 or f=18) then goto 10 if a=15 and (f=2 or f=4 or f=6 or f=8 or f=19) then goto 10 if a=16 and (f=1 or f=4 or f=5 or f=8 or f=20) then goto 10 if a=17 and (f=5 or f=7 or f=9 or f=11 or f=13) then goto 10 if a=18 and (f=6 or f=7 or f=10 or f=11 or f=14) then goto 10 if a=19 and (f=6 or f=8 or f=10 or f=12 or f=15) then goto 10 if a=20 and (f=5 or f=8 or f=9 or f=12 or f=16) then goto 10 if b=1 and (f=3 or f=4 or f=13 or f=16) then goto 10 if b=2 and (f=3 or f=4 or f=14 or f=15) then goto 10 if b=3 and (f=1 or f=2 or f=13 or f=14) then goto 10 if b=4 and (f=1 or f=2 or f=15 or f=16) then goto 10 if b=5 and (f=7 or f=8 or f=13 or f=16 or f=17 or f=20) then goto 10 if b=6 and (f=7 or f=8 or f=14 or f=15 or f=18 or f=19) then goto 10 if b=7 and (f=5 or f=6 or f=13 or f=14 or f=17 or f=18) then goto 10 if b=8 and (f=5 or f=6 or f=15 or f=16 or f=19 or f=20) then goto 10 if b=9 and (f=11 or f=12 or f=17 or f=20) then goto 10 if b=10 and (f=11 or f=12 or f=18 or f=19) then goto 10 if b=11 and (f=9 or f=10 or f=17 or f=18) then goto 10 if b=12 and (f=9 or f=10 or f=19 or f=20) then goto 10 if b=13 and (f=1 or f=3 or f=5 or f=7 or f=17) then goto 10 if b=14 and (f=2 or f=3 or f=6 or f=7 or f=18) then goto 10 if b=15 and (f=2 or f=4 or f=6 or f=8 or f=19) then goto 10 if b=16 and (f=1 or f=4 or f=5 or f=8 or f=20) then goto 10 if b=17 and (f=5 or f=7 or f=9 or f=11 or f=13) then goto 10 if b=18 and (f=6 or f=7 or f=10 or f=11 or f=14) then goto 10 if b=19 and (f=6 or f=8 or f=10 or f=12 or f=15) then goto 10 if b=20 and (f=5 or f=8 or f=9 or f=12 or f=16) then goto 10 if c=1 and (f=3 or f=4 or f=13 or f=16) then goto 10 if c=2 and (f=3 or f=4 or f=14 or f=15) then goto 10 if c=3 and (f=1 or f=2 or f=13 or f=14) then goto 10 if c=4 and (f=1 or f=2 or f=15 or f=16) then goto 10 if c=5 and (f=7 or f=8 or f=13 or f=16 or f=17 or f=20) then goto 10 if c=6 and (f=7 or f=8 or f=14 or f=15 or f=18 or f=19) then goto 10 if c=7 and (f=5 or f=6 or f=13 or f=14 or f=17 or f=18) then goto 10 if c=8 and (f=5 or f=6 or f=15 or f=16 or f=19 or f=20) then goto 10 if c=9 and (f=11 or f=12 or f=17 or f=20) then goto 10 if c=10 and (f=11 or f=12 or f=18 or f=19) then goto 10 if c=11 and (f=9 or f=10 or f=17 or f=18) then goto 10 if c=12 and (f=9 or f=10 or f=19 or f=20) then goto 10 if c=13 and (f=1 or f=3 or f=5 or f=7 or f=17) then goto 10 if c=14 and (f=2 or f=3 or f=6 or f=7 or f=18) then goto 10 if c=15 and (f=2 or f=4 or f=6 or f=8 or f=19) then goto 10 if c=16 and (f=1 or f=4 or f=5 or f=8 or f=20) then goto 10 if c=17 and (f=5 or f=7 or f=9 or f=11 or f=13) then goto 10 if c=18 and (f=6 or f=7 or f=10 or f=11 or f=14) then goto 10 if c=19 and (f=6 or f=8 or f=10 or f=12 or f=15) then goto 10 if c=20 and (f=5 or f=8 or f=9 or f=12 or f=16) then goto 10 if d=1 and (f=3 or f=4 or f=13 or f=16) then goto 10 if d=2 and (f=3 or f=4 or f=14 or f=15) then goto 10 if d=3 and (f=1 or f=2 or f=13 or f=14) then goto 10 if d=4 and (f=1 or f=2 or f=15 or f=16) then goto 10 if d=5 and (f=7 or f=8 or f=13 or f=16 or f=17 or f=20) then goto 10 if d=6 and (f=7 or f=8 or f=14 or f=15 or f=18 or f=19) then goto 10 if d=7 and (f=5 or f=6 or f=13 or f=14 or f=17 or f=18) then goto 10 if d=8 and (f=5 or f=6 or f=15 or f=16 or f=19 or f=20) then goto 10 if d=9 and (f=11 or f=12 or f=17 or f=20) then goto 10 if d=10 and (f=11 or f=12 or f=18 or f=19) then goto 10 if d=11 and (f=9 or f=10 or f=17 or f=18) then goto 10 if d=12 and (f=9 or f=10 or f=19 or f=20) then goto 10 if d=13 and (f=1 or f=3 or f=5 or f=7 or f=17) then goto 10 if d=14 and (f=2 or f=3 or f=6 or f=7 or f=18) then goto 10 if d=15 and (f=2 or f=4 or f=6 or f=8 or f=19) then goto 10 if d=16 and (f=1 or f=4 or f=5 or f=8 or f=20) then goto 10 if d=17 and (f=5 or f=7 or f=9 or f=11 or f=13) then goto 10 if d=18 and (f=6 or f=7 or f=10 or f=11 or f=14) then goto 10 if d=19 and (f=6 or f=8 or f=10 or f=12 or f=15) then goto 10 if d=20 and (f=5 or f=8 or f=9 or f=12 or f=16) then goto 10 if e=1 and (f=3 or f=4 or f=13 or f=16) then goto 10 if e=2 and (f=3 or f=4 or f=14 or f=15) then goto 10 if e=3 and (f=1 or f=2 or f=13 or f=14) then goto 10 if e=4 and (f=1 or f=2 or f=15 or f=16) then goto 10 if e=5 and (f=7 or f=8 or f=13 or f=16 or f=17 or f=20) then goto 10 if e=6 and (f=7 or f=8 or f=14 or f=15 or f=18 or f=19) then goto 10 if e=7 and (f=5 or f=6 or f=13 or f=14 or f=17 or f=18) then goto 10 if e=8 and (f=5 or f=6 or f=15 or f=16 or f=19 or f=20) then goto 10 if e=9 and (f=11 or f=12 or f=17 or f=20) then goto 10 if e=10 and (f=11 or f=12 or f=18 or f=19) then goto 10 if e=11 and (f=9 or f=10 or f=17 or f=18) then goto 10 if e=12 and (f=9 or f=10 or f=19 or f=20) then goto 10 if e=13 and (f=1 or f=3 or f=5 or f=7 or f=17) then goto 10 if e=14 and (f=2 or f=3 or f=6 or f=7 or f=18) then goto 10 if e=15 and (f=2 or f=4 or f=6 or f=8 or f=19) then goto 10 if e=16 and (f=1 or f=4 or f=5 or f=8 or f=20) then goto 10 if e=17 and (f=5 or f=7 or f=9 or f=11 or f=13) then goto 10 if e=18 and (f=6 or f=7 or f=10 or f=11 or f=14) then goto 10 if e=19 and (f=6 or f=8 or f=10 or f=12 or f=15) then goto 10 if e=20 and (f=5 or f=8 or f=9 or f=12 or f=16) then goto 10 let s=s+1 10 next f 20 next e 30 next d 40 next c 50 next b 60 next a print s/fact(6) print time$ end f9押して 05:37:36 32 05:37:39 |
|
豊川市
9月9日(木) 5:41:02
MAIL:fttnm528@ybb.ne.jp 50827 |
|
「数学」小旅行 |
|
1×1×2の直方体の頂点を隣り合った2個ずつに分けることを考えました。
樹形図をつかいました。 |
|
9月9日(木) 7:23:04
50828 |
|
スモークマン |
|
上の面2x2 の分割方法
|or ー の2通り・・・それぞれ左側面...5通り T の4通り...2通り + の1通り...2通り so...2*5*2+4*2*2+1*2*2=40通り という単純なことではなく重複するものがあるんだろうと...認証でした Orz 2^3=8個が重複しているようですがようわかりませんです...^^; 皆さんのでお勉強 ^^ |
|
9月9日(木) 14:11:43
50829 |
|
SECOND |
|
#50824 サイトの紹介ありがとうございます。
https://oeis.org/A006253 、a(n)*(-1)^n = (1-T(n+1,-2))/3, n>=0 を計算してみた。 今回は a(3) の場合の様で、4cm だと 121通りになるのかな、、なぜこうなるのか?我輩はネコに小判である、 FOR n=0 TO 25 IF MOD(n,5)=0 THEN PRINT CHR$(13);CHR$(10);"!"; PRINT " a(";STR$(n);")=";(1-T(n+1,-2))/3/(-1)^n; NEXT n FUNCTION T(n,x) !n次,xの、Chebyshev(チェビシェフ)多項式の値 IF n=0 THEN LET T=1 ELSEIF n=1 THEN LET T=x ELSEIF 2<=n THEN LET T=2*x*T(n-1,x)-T(n-2,x) END IF END FUNCTION ! a(0)= 1 a(1)= 2 a(2)= 9 a(3)= 32 a(4)= 121 ! a(5)= 450 a(6)= 1681 a(7)= 6272 a(8)= 23409 a(9)= 87362 ! a(10)= 326041 a(11)= 1216800 a(12)= 4541161 a(13)= 16947842 a(14)= 63250209 ! a(15)= 236052992 a(16)= 880961761 a(17)= 3287794050 a(18)= 12270214441 a(19)= 45793063712 ! a(20)= 170902040409 a(21)= 637815097922 a(22)= 2380358351281 a(23)= 8883618307200 a(24)= 33154114877521 ! a(25)= 123732841202882 |
|
9月9日(木) 22:25:13
50830 |
|
みかん |
|
いつものように漸化式っぽくやろうと、1段の場合・2段の場合を考えて
結果を利用しようとしてうまく行かず、結局場合分けでした。 ワンパターンで解こうとしてもうまくいかない、ってことですね。 |
|
9月9日(木) 23:36:12
50831 |
|
だいすけ @カレー好き |
|
お久しぶりです。10月から奈良に転勤になりました。
今回の問題は頭の中で解けました。 1段+1段+1段が8通り 上1段+下2段が10通り 上2段+下1段が10通り 3段が4通り 合計32通り |
|
9月10日(金) 0:15:10
50832 |
|
「数学」小旅行 |
|
#50828 自己レスです。
言い方が不十分でした。2×2×3の直方体を単位立方体に分割して、それぞれを点だと考えると、 4×3=12個の点が直方体(単位立方体2個)になります。 これらの点から隣り合う2個をつなげると問題の小さな直方体1個に対応します。 そんなわけで、12個の点を隣り合う2個ずつに分ける分け方の数を数えるといいと考えました。 そんな発想から、いつものようにRubyプログラムをしてみました。2×2×nの場合の数を計算します。 n=3 m=2*n k=(0..4*n-1).to_a.permutation p k.map{|x|x.each_slice(2).map{|y|y.sort}.sort.to_a}.uniq.count{|v|v.count{|z|a=z[1]-z[0];a==3&&(z[0]%4==0)||a==1||a==4}==m} 時間はかかりますねWWW |
|
9月10日(金) 8:39:25
50833 |
|
「数学」小旅行 |
|
#50824 人間ってホントにすごいと思いました。
ご紹介のサイトの中に漸化式もありました。 a(n+3)=-a(n)+3*a(n+1)+3*a(n+2)が成り立つようです。(なんでだろ♪〜??) とにもかくにも、使うと一発で瞬時に20cmの分まで出ました。 n=20 $k=[0,1,2] for i in 2..n $k.push -$k[i-2]+3*$k[i-1]+3*$k[i] end 答えは、 [0, 1, 2, 9, 32, 121, 450, 1681, 6272, 23409, 87362, 326041, 1216800, 4541161, 16947842, 63250209, 236052992, 880961761, 3287794050, 12270214441, 45793063712, 170902040409] ですって!! |
|
9月10日(金) 13:00:13
50834 |
|
ゴンとも |
|
#50827
自己レスで・・・ >容器に直方体xは20箇所置けるが >1から20まで番号を振り被らないようにして 番号は問題文の容器を 1*1の立方体でアルファべットを振り 1番上: ad bc 真中: eh fg 1番下: il jk で20箇所は 1=a+d,2=b+c,3=a+b,4=c+d,5=e+h,6=f+g,7=e+f,8=g+h,9=i+l,10=j+k,11=i+j,12=l+k 13=a+e,14=b+f,15=c+g,16=d+h,17=e+i,18=f+j,19=g+k,20=h+lで 実行速度を上げて番号を振り直方体xがどのように詰め込まれるかをだしてみました!! print time$ for a=1 to 20 for b=a+1 to 20 if b=a then goto 50 if a=1 and (b=3 or b=4 or b=13 or b=16) then goto 50 if a=2 and (b=3 or b=4 or b=14 or b=15) then goto 50 if a=3 and (b=1 or b=2 or b=13 or b=14) then goto 50 if a=4 and (b=1 or b=2 or b=15 or b=16) then goto 50 if a=5 and (b=7 or b=8 or b=13 or b=16 or b=17 or b=20) then goto 50 if a=6 and (b=7 or b=8 or b=14 or b=15 or b=18 or b=19) then goto 50 if a=7 and (b=5 or b=6 or b=13 or b=14 or b=17 or b=18) then goto 50 if a=8 and (b=5 or b=6 or b=15 or b=16 or b=19 or b=20) then goto 50 if a=9 and (b=11 or b=12 or b=17 or b=20) then goto 50 if a=10 and (b=11 or b=12 or b=18 or b=19) then goto 50 if a=11 and (b=9 or b=10 or b=17 or b=18) then goto 50 if a=12 and (b=9 or b=10 or b=19 or b=20) then goto 50 if a=13 and (b=1 or b=3 or b=5 or b=7 or b=17) then goto 50 if a=14 and (b=2 or b=3 or b=6 or b=7 or b=18) then goto 50 if a=15 and (b=2 or b=4 or b=6 or b=8 or b=19) then goto 50 if a=16 and (b=1 or b=4 or b=5 or b=8 or b=20) then goto 50 if a=17 and (b=5 or b=7 or b=9 or b=11 or b=13) then goto 50 if a=18 and (b=6 or b=7 or b=10 or b=11 or b=14) then goto 50 if a=19 and (b=6 or b=8 or b=10 or b=12 or b=15) then goto 50 if a=20 and (b=5 or b=8 or b=9 or b=12 or b=16) then goto 50 for c=b+1 to 20 if c=a or c=b then goto 40 if a=1 and (c=3 or c=4 or c=13 or c=16) then goto 40 if a=2 and (c=3 or c=4 or c=14 or c=15) then goto 40 if a=3 and (c=1 or c=2 or c=13 or c=14) then goto 40 if a=4 and (c=1 or c=2 or c=15 or c=16) then goto 40 if a=5 and (c=7 or c=8 or c=13 or c=16 or c=17 or c=20) then goto 40 if a=6 and (c=7 or c=8 or c=14 or c=15 or c=18 or c=19) then goto 40 if a=7 and (c=5 or c=6 or c=13 or c=14 or c=17 or c=18) then goto 40 if a=8 and (c=5 or c=6 or c=15 or c=16 or c=19 or c=20) then goto 40 if a=9 and (c=11 or c=12 or c=17 or c=20) then goto 40 if a=10 and (c=11 or c=12 or c=18 or c=19) then goto 40 if a=11 and (c=9 or c=10 or c=17 or c=18) then goto 40 if a=12 and (c=9 or c=10 or c=19 or c=20) then goto 40 if a=13 and (c=1 or c=3 or c=5 or c=7 or c=17) then goto 40 if a=14 and (c=2 or c=3 or c=6 or c=7 or c=18) then goto 40 if a=15 and (c=2 or c=4 or c=6 or c=8 or c=19) then goto 40 if a=16 and (c=1 or c=4 or c=5 or c=8 or c=20) then goto 40 if a=17 and (c=5 or c=7 or c=9 or c=11 or c=13) then goto 40 if a=18 and (c=6 or c=7 or c=10 or c=11 or c=14) then goto 40 if a=19 and (c=6 or c=8 or c=10 or c=12 or c=15) then goto 40 if a=20 and (c=5 or c=8 or c=9 or c=12 or c=16) then goto 40 if b=1 and (c=3 or c=4 or c=13 or c=16) then goto 40 if b=2 and (c=3 or c=4 or c=14 or c=15) then goto 40 if b=3 and (c=1 or c=2 or c=13 or c=14) then goto 40 if b=4 and (c=1 or c=2 or c=15 or c=16) then goto 40 if b=5 and (c=7 or c=8 or c=13 or c=16 or c=17 or c=20) then goto 40 if b=6 and (c=7 or c=8 or c=14 or c=15 or c=18 or c=19) then goto 40 if b=7 and (c=5 or c=6 or c=13 or c=14 or c=17 or c=18) then goto 40 if b=8 and (c=5 or c=6 or c=15 or c=16 or c=19 or c=20) then goto 40 if b=9 and (c=11 or c=12 or c=17 or c=20) then goto 40 if b=10 and (c=11 or c=12 or c=18 or c=19) then goto 40 if b=11 and (c=9 or c=10 or c=17 or c=18) then goto 40 if b=12 and (c=9 or c=10 or c=19 or c=20) then goto 40 if b=13 and (c=1 or c=3 or c=5 or c=7 or c=17) then goto 40 if b=14 and (c=2 or c=3 or c=6 or c=7 or c=18) then goto 40 if b=15 and (c=2 or c=4 or c=6 or c=8 or c=19) then goto 40 if b=16 and (c=1 or c=4 or c=5 or c=8 or c=20) then goto 40 if b=17 and (c=5 or c=7 or c=9 or c=11 or c=13) then goto 40 if b=18 and (c=6 or c=7 or c=10 or c=11 or c=14) then goto 40 if b=19 and (c=6 or c=8 or c=10 or c=12 or c=15) then goto 40 if b=20 and (c=5 or c=8 or c=9 or c=12 or c=16) then goto 40 for d=c+1 to 20 if d=a or d=b or d=c then goto 30 if a=1 and (d=3 or d=4 or d=13 or d=16) then goto 30 if a=2 and (d=3 or d=4 or d=14 or d=15) then goto 30 if a=3 and (d=1 or d=2 or d=13 or d=14) then goto 30 if a=4 and (d=1 or d=2 or d=15 or d=16) then goto 30 if a=5 and (d=7 or d=8 or d=13 or d=16 or d=17 or d=20) then goto 30 if a=6 and (d=7 or d=8 or d=14 or d=15 or d=18 or d=19) then goto 30 if a=7 and (d=5 or d=6 or d=13 or d=14 or d=17 or d=18) then goto 30 if a=8 and (d=5 or d=6 or d=15 or d=16 or d=19 or d=20) then goto 30 if a=9 and (d=11 or d=12 or d=17 or d=20) then goto 30 if a=10 and (d=11 or d=12 or d=18 or d=19) then goto 30 if a=11 and (d=9 or d=10 or d=17 or d=18) then goto 30 if a=12 and (d=9 or d=10 or d=19 or d=20) then goto 30 if a=13 and (d=1 or d=3 or d=5 or d=7 or d=17) then goto 30 if a=14 and (d=2 or d=3 or d=6 or d=7 or d=18) then goto 30 if a=15 and (d=2 or d=4 or d=6 or d=8 or d=19) then goto 30 if a=16 and (d=1 or d=4 or d=5 or d=8 or d=20) then goto 30 if a=17 and (d=5 or d=7 or d=9 or d=11 or d=13) then goto 30 if a=18 and (d=6 or d=7 or d=10 or d=11 or d=14) then goto 30 if a=19 and (d=6 or d=8 or d=10 or d=12 or d=15) then goto 30 if a=20 and (d=5 or d=8 or d=9 or d=12 or d=16) then goto 30 if b=1 and (d=3 or d=4 or d=13 or d=16) then goto 30 if b=2 and (d=3 or d=4 or d=14 or d=15) then goto 30 if b=3 and (d=1 or d=2 or d=13 or d=14) then goto 30 if b=4 and (d=1 or d=2 or d=15 or d=16) then goto 30 if b=5 and (d=7 or d=8 or d=13 or d=16 or d=17 or d=20) then goto 30 if b=6 and (d=7 or d=8 or d=14 or d=15 or d=18 or d=19) then goto 30 if b=7 and (d=5 or d=6 or d=13 or d=14 or d=17 or d=18) then goto 30 if b=8 and (d=5 or d=6 or d=15 or d=16 or d=19 or d=20) then goto 30 if b=9 and (d=11 or d=12 or d=17 or d=20) then goto 30 if b=10 and (d=11 or d=12 or d=18 or d=19) then goto 30 if b=11 and (d=9 or d=10 or d=17 or d=18) then goto 30 if b=12 and (d=9 or d=10 or d=19 or d=20) then goto 30 if b=13 and (d=1 or d=3 or d=5 or d=7 or d=17) then goto 30 if b=14 and (d=2 or d=3 or d=6 or d=7 or d=18) then goto 30 if b=15 and (d=2 or d=4 or d=6 or d=8 or d=19) then goto 30 if b=16 and (d=1 or d=4 or d=5 or d=8 or d=20) then goto 30 if b=17 and (d=5 or d=7 or d=9 or d=11 or d=13) then goto 30 if b=18 and (d=6 or d=7 or d=10 or d=11 or d=14) then goto 30 if b=19 and (d=6 or d=8 or d=10 or d=12 or d=15) then goto 30 if b=20 and (d=5 or d=8 or d=9 or d=12 or d=16) then goto 30 if c=1 and (d=3 or d=4 or d=13 or d=16) then goto 30 if c=2 and (d=3 or d=4 or d=14 or d=15) then goto 30 if c=3 and (d=1 or d=2 or d=13 or d=14) then goto 30 if c=4 and (d=1 or d=2 or d=15 or d=16) then goto 30 if c=5 and (d=7 or d=8 or d=13 or d=16 or d=17 or d=20) then goto 30 if c=6 and (d=7 or d=8 or d=14 or d=15 or d=18 or d=19) then goto 30 if c=7 and (d=5 or d=6 or d=13 or d=14 or d=17 or d=18) then goto 30 if c=8 and (d=5 or d=6 or d=15 or d=16 or d=19 or d=20) then goto 30 if c=9 and (d=11 or d=12 or d=17 or d=20) then goto 30 if c=10 and (d=11 or d=12 or d=18 or d=19) then goto 30 if c=11 and (d=9 or d=10 or d=17 or d=18) then goto 30 if c=12 and (d=9 or d=10 or d=19 or d=20) then goto 30 if c=13 and (d=1 or d=3 or d=5 or d=7 or d=17) then goto 30 if c=14 and (d=2 or d=3 or d=6 or d=7 or d=18) then goto 30 if c=15 and (d=2 or d=4 or d=6 or d=8 or d=19) then goto 30 if c=16 and (d=1 or d=4 or d=5 or d=8 or d=20) then goto 30 if c=17 and (d=5 or d=7 or d=9 or d=11 or d=13) then goto 30 if c=18 and (d=6 or d=7 or d=10 or d=11 or d=14) then goto 30 if c=19 and (d=6 or d=8 or d=10 or d=12 or d=15) then goto 30 if c=20 and (d=5 or d=8 or d=9 or d=12 or d=16) then goto 30 for e=d+1 to 20 if e=a or e=b or e=c or e=d then goto 20 if a=1 and (e=3 or e=4 or e=13 or e=16) then goto 20 if a=2 and (e=3 or e=4 or e=14 or e=15) then goto 20 if a=3 and (e=1 or e=2 or e=13 or e=14) then goto 20 if a=4 and (e=1 or e=2 or e=15 or e=16) then goto 20 if a=5 and (e=7 or e=8 or e=13 or e=16 or e=17 or e=20) then goto 20 if a=6 and (e=7 or e=8 or e=14 or e=15 or e=18 or e=19) then goto 20 if a=7 and (e=5 or e=6 or e=13 or e=14 or e=17 or e=18) then goto 20 if a=8 and (e=5 or e=6 or e=15 or e=16 or e=19 or e=20) then goto 20 if a=9 and (e=11 or e=12 or e=17 or e=20) then goto 20 if a=10 and (e=11 or e=12 or e=18 or e=19) then goto 20 if a=11 and (e=9 or e=10 or e=17 or e=18) then goto 20 if a=12 and (e=9 or e=10 or e=19 or e=20) then goto 20 if a=13 and (e=1 or e=3 or e=5 or e=7 or e=17) then goto 20 if a=14 and (e=2 or e=3 or e=6 or e=7 or e=18) then goto 20 if a=15 and (e=2 or e=4 or e=6 or e=8 or e=19) then goto 20 if a=16 and (e=1 or e=4 or e=5 or e=8 or e=20) then goto 20 if a=17 and (e=5 or e=7 or e=9 or e=11 or e=13) then goto 20 if a=18 and (e=6 or e=7 or e=10 or e=11 or e=14) then goto 20 if a=19 and (e=6 or e=8 or e=10 or e=12 or e=15) then goto 20 if a=20 and (e=5 or e=8 or e=9 or e=12 or e=16) then goto 20 if b=1 and (e=3 or e=4 or e=13 or e=16) then goto 20 if b=2 and (e=3 or e=4 or e=14 or e=15) then goto 20 if b=3 and (e=1 or e=2 or e=13 or e=14) then goto 20 if b=4 and (e=1 or e=2 or e=15 or e=16) then goto 20 if b=5 and (e=7 or e=8 or e=13 or e=16 or e=17 or e=20) then goto 20 if b=6 and (e=7 or e=8 or e=14 or e=15 or e=18 or e=19) then goto 20 if b=7 and (e=5 or e=6 or e=13 or e=14 or e=17 or e=18) then goto 20 if b=8 and (e=5 or e=6 or e=15 or e=16 or e=19 or e=20) then goto 20 if b=9 and (e=11 or e=12 or e=17 or e=20) then goto 20 if b=10 and (e=11 or e=12 or e=18 or e=19) then goto 20 if b=11 and (e=9 or e=10 or e=17 or e=18) then goto 20 if b=12 and (e=9 or e=10 or e=19 or e=20) then goto 20 if b=13 and (e=1 or e=3 or e=5 or e=7 or e=17) then goto 20 if b=14 and (e=2 or e=3 or e=6 or e=7 or e=18) then goto 20 if b=15 and (e=2 or e=4 or e=6 or e=8 or e=19) then goto 20 if b=16 and (e=1 or e=4 or e=5 or e=8 or e=20) then goto 20 if b=17 and (e=5 or e=7 or e=9 or e=11 or e=13) then goto 20 if b=18 and (e=6 or e=7 or e=10 or e=11 or e=14) then goto 20 if b=19 and (e=6 or e=8 or e=10 or e=12 or e=15) then goto 20 if b=20 and (e=5 or e=8 or e=9 or e=12 or e=16) then goto 20 if c=1 and (e=3 or e=4 or e=13 or e=16) then goto 20 if c=2 and (e=3 or e=4 or e=14 or e=15) then goto 20 if c=3 and (e=1 or e=2 or e=13 or e=14) then goto 20 if c=4 and (e=1 or e=2 or e=15 or e=16) then goto 20 if c=5 and (e=7 or e=8 or e=13 or e=16 or e=17 or e=20) then goto 20 if c=6 and (e=7 or e=8 or e=14 or e=15 or e=18 or e=19) then goto 20 if c=7 and (e=5 or e=6 or e=13 or e=14 or e=17 or e=18) then goto 20 if c=8 and (e=5 or e=6 or e=15 or e=16 or e=19 or e=20) then goto 20 if c=9 and (e=11 or e=12 or e=17 or e=20) then goto 20 if c=10 and (e=11 or e=12 or e=18 or e=19) then goto 20 if c=11 and (e=9 or e=10 or e=17 or e=18) then goto 20 if c=12 and (e=9 or e=10 or e=19 or e=20) then goto 20 if c=13 and (e=1 or e=3 or e=5 or e=7 or e=17) then goto 20 if c=14 and (e=2 or e=3 or e=6 or e=7 or e=18) then goto 20 if c=15 and (e=2 or e=4 or e=6 or e=8 or e=19) then goto 20 if c=16 and (e=1 or e=4 or e=5 or e=8 or e=20) then goto 20 if c=17 and (e=5 or e=7 or e=9 or e=11 or e=13) then goto 20 if c=18 and (e=6 or e=7 or e=10 or e=11 or e=14) then goto 20 if c=19 and (e=6 or e=8 or e=10 or e=12 or e=15) then goto 20 if c=20 and (e=5 or e=8 or e=9 or e=12 or e=16) then goto 20 if d=1 and (e=3 or e=4 or e=13 or e=16) then goto 20 if d=2 and (e=3 or e=4 or e=14 or e=15) then goto 20 if d=3 and (e=1 or e=2 or e=13 or e=14) then goto 20 if d=4 and (e=1 or e=2 or e=15 or e=16) then goto 20 if d=5 and (e=7 or e=8 or e=13 or e=16 or e=17 or e=20) then goto 20 if d=6 and (e=7 or e=8 or e=14 or e=15 or e=18 or e=19) then goto 20 if d=7 and (e=5 or e=6 or e=13 or e=14 or e=17 or e=18) then goto 20 if d=8 and (e=5 or e=6 or e=15 or e=16 or e=19 or e=20) then goto 20 if d=9 and (e=11 or e=12 or e=17 or e=20) then goto 20 if d=10 and (e=11 or e=12 or e=18 or e=19) then goto 20 if d=11 and (e=9 or e=10 or e=17 or e=18) then goto 20 if d=12 and (e=9 or e=10 or e=19 or e=20) then goto 20 if d=13 and (e=1 or e=3 or e=5 or e=7 or e=17) then goto 20 if d=14 and (e=2 or e=3 or e=6 or e=7 or e=18) then goto 20 if d=15 and (e=2 or e=4 or e=6 or e=8 or e=19) then goto 20 if d=16 and (e=1 or e=4 or e=5 or e=8 or e=20) then goto 20 if d=17 and (e=5 or e=7 or e=9 or e=11 or e=13) then goto 20 if d=18 and (e=6 or e=7 or e=10 or e=11 or e=14) then goto 20 if d=19 and (e=6 or e=8 or e=10 or e=12 or e=15) then goto 20 if d=20 and (e=5 or e=8 or e=9 or e=12 or e=16) then goto 20 for f=e+1 to 20 if f=a or f=b or f=c or f=d or f=e then goto 10 if a=1 and (f=3 or f=4 or f=13 or f=16) then goto 10 if a=2 and (f=3 or f=4 or f=14 or f=15) then goto 10 if a=3 and (f=1 or f=2 or f=13 or f=14) then goto 10 if a=4 and (f=1 or f=2 or f=15 or f=16) then goto 10 if a=5 and (f=7 or f=8 or f=13 or f=16 or f=17 or f=20) then goto 10 if a=6 and (f=7 or f=8 or f=14 or f=15 or f=18 or f=19) then goto 10 if a=7 and (f=5 or f=6 or f=13 or f=14 or f=17 or f=18) then goto 10 if a=8 and (f=5 or f=6 or f=15 or f=16 or f=19 or f=20) then goto 10 if a=9 and (f=11 or f=12 or f=17 or f=20) then goto 10 if a=10 and (f=11 or f=12 or f=18 or f=19) then goto 10 if a=11 and (f=9 or f=10 or f=17 or f=18) then goto 10 if a=12 and (f=9 or f=10 or f=19 or f=20) then goto 10 if a=13 and (f=1 or f=3 or f=5 or f=7 or f=17) then goto 10 if a=14 and (f=2 or f=3 or f=6 or f=7 or f=18) then goto 10 if a=15 and (f=2 or f=4 or f=6 or f=8 or f=19) then goto 10 if a=16 and (f=1 or f=4 or f=5 or f=8 or f=20) then goto 10 if a=17 and (f=5 or f=7 or f=9 or f=11 or f=13) then goto 10 if a=18 and (f=6 or f=7 or f=10 or f=11 or f=14) then goto 10 if a=19 and (f=6 or f=8 or f=10 or f=12 or f=15) then goto 10 if a=20 and (f=5 or f=8 or f=9 or f=12 or f=16) then goto 10 if b=1 and (f=3 or f=4 or f=13 or f=16) then goto 10 if b=2 and (f=3 or f=4 or f=14 or f=15) then goto 10 if b=3 and (f=1 or f=2 or f=13 or f=14) then goto 10 if b=4 and (f=1 or f=2 or f=15 or f=16) then goto 10 if b=5 and (f=7 or f=8 or f=13 or f=16 or f=17 or f=20) then goto 10 if b=6 and (f=7 or f=8 or f=14 or f=15 or f=18 or f=19) then goto 10 if b=7 and (f=5 or f=6 or f=13 or f=14 or f=17 or f=18) then goto 10 if b=8 and (f=5 or f=6 or f=15 or f=16 or f=19 or f=20) then goto 10 if b=9 and (f=11 or f=12 or f=17 or f=20) then goto 10 if b=10 and (f=11 or f=12 or f=18 or f=19) then goto 10 if b=11 and (f=9 or f=10 or f=17 or f=18) then goto 10 if b=12 and (f=9 or f=10 or f=19 or f=20) then goto 10 if b=13 and (f=1 or f=3 or f=5 or f=7 or f=17) then goto 10 if b=14 and (f=2 or f=3 or f=6 or f=7 or f=18) then goto 10 if b=15 and (f=2 or f=4 or f=6 or f=8 or f=19) then goto 10 if b=16 and (f=1 or f=4 or f=5 or f=8 or f=20) then goto 10 if b=17 and (f=5 or f=7 or f=9 or f=11 or f=13) then goto 10 if b=18 and (f=6 or f=7 or f=10 or f=11 or f=14) then goto 10 if b=19 and (f=6 or f=8 or f=10 or f=12 or f=15) then goto 10 if b=20 and (f=5 or f=8 or f=9 or f=12 or f=16) then goto 10 if c=1 and (f=3 or f=4 or f=13 or f=16) then goto 10 if c=2 and (f=3 or f=4 or f=14 or f=15) then goto 10 if c=3 and (f=1 or f=2 or f=13 or f=14) then goto 10 if c=4 and (f=1 or f=2 or f=15 or f=16) then goto 10 if c=5 and (f=7 or f=8 or f=13 or f=16 or f=17 or f=20) then goto 10 if c=6 and (f=7 or f=8 or f=14 or f=15 or f=18 or f=19) then goto 10 if c=7 and (f=5 or f=6 or f=13 or f=14 or f=17 or f=18) then goto 10 if c=8 and (f=5 or f=6 or f=15 or f=16 or f=19 or f=20) then goto 10 if c=9 and (f=11 or f=12 or f=17 or f=20) then goto 10 if c=10 and (f=11 or f=12 or f=18 or f=19) then goto 10 if c=11 and (f=9 or f=10 or f=17 or f=18) then goto 10 if c=12 and (f=9 or f=10 or f=19 or f=20) then goto 10 if c=13 and (f=1 or f=3 or f=5 or f=7 or f=17) then goto 10 if c=14 and (f=2 or f=3 or f=6 or f=7 or f=18) then goto 10 if c=15 and (f=2 or f=4 or f=6 or f=8 or f=19) then goto 10 if c=16 and (f=1 or f=4 or f=5 or f=8 or f=20) then goto 10 if c=17 and (f=5 or f=7 or f=9 or f=11 or f=13) then goto 10 if c=18 and (f=6 or f=7 or f=10 or f=11 or f=14) then goto 10 if c=19 and (f=6 or f=8 or f=10 or f=12 or f=15) then goto 10 if c=20 and (f=5 or f=8 or f=9 or f=12 or f=16) then goto 10 if d=1 and (f=3 or f=4 or f=13 or f=16) then goto 10 if d=2 and (f=3 or f=4 or f=14 or f=15) then goto 10 if d=3 and (f=1 or f=2 or f=13 or f=14) then goto 10 if d=4 and (f=1 or f=2 or f=15 or f=16) then goto 10 if d=5 and (f=7 or f=8 or f=13 or f=16 or f=17 or f=20) then goto 10 if d=6 and (f=7 or f=8 or f=14 or f=15 or f=18 or f=19) then goto 10 if d=7 and (f=5 or f=6 or f=13 or f=14 or f=17 or f=18) then goto 10 if d=8 and (f=5 or f=6 or f=15 or f=16 or f=19 or f=20) then goto 10 if d=9 and (f=11 or f=12 or f=17 or f=20) then goto 10 if d=10 and (f=11 or f=12 or f=18 or f=19) then goto 10 if d=11 and (f=9 or f=10 or f=17 or f=18) then goto 10 if d=12 and (f=9 or f=10 or f=19 or f=20) then goto 10 if d=13 and (f=1 or f=3 or f=5 or f=7 or f=17) then goto 10 if d=14 and (f=2 or f=3 or f=6 or f=7 or f=18) then goto 10 if d=15 and (f=2 or f=4 or f=6 or f=8 or f=19) then goto 10 if d=16 and (f=1 or f=4 or f=5 or f=8 or f=20) then goto 10 if d=17 and (f=5 or f=7 or f=9 or f=11 or f=13) then goto 10 if d=18 and (f=6 or f=7 or f=10 or f=11 or f=14) then goto 10 if d=19 and (f=6 or f=8 or f=10 or f=12 or f=15) then goto 10 if d=20 and (f=5 or f=8 or f=9 or f=12 or f=16) then goto 10 if e=1 and (f=3 or f=4 or f=13 or f=16) then goto 10 if e=2 and (f=3 or f=4 or f=14 or f=15) then goto 10 if e=3 and (f=1 or f=2 or f=13 or f=14) then goto 10 if e=4 and (f=1 or f=2 or f=15 or f=16) then goto 10 if e=5 and (f=7 or f=8 or f=13 or f=16 or f=17 or f=20) then goto 10 if e=6 and (f=7 or f=8 or f=14 or f=15 or f=18 or f=19) then goto 10 if e=7 and (f=5 or f=6 or f=13 or f=14 or f=17 or f=18) then goto 10 if e=8 and (f=5 or f=6 or f=15 or f=16 or f=19 or f=20) then goto 10 if e=9 and (f=11 or f=12 or f=17 or f=20) then goto 10 if e=10 and (f=11 or f=12 or f=18 or f=19) then goto 10 if e=11 and (f=9 or f=10 or f=17 or f=18) then goto 10 if e=12 and (f=9 or f=10 or f=19 or f=20) then goto 10 if e=13 and (f=1 or f=3 or f=5 or f=7 or f=17) then goto 10 if e=14 and (f=2 or f=3 or f=6 or f=7 or f=18) then goto 10 if e=15 and (f=2 or f=4 or f=6 or f=8 or f=19) then goto 10 if e=16 and (f=1 or f=4 or f=5 or f=8 or f=20) then goto 10 if e=17 and (f=5 or f=7 or f=9 or f=11 or f=13) then goto 10 if e=18 and (f=6 or f=7 or f=10 or f=11 or f=14) then goto 10 if e=19 and (f=6 or f=8 or f=10 or f=12 or f=15) then goto 10 if e=20 and (f=5 or f=8 or f=9 or f=12 or f=16) then goto 10 let s=s+1 PRINT s;"//";a;b;c;d;e;f 10 next f 20 next e 30 next d 40 next c 50 next b 60 next a print time$ end f9押して 15:40:06 1 // 1 2 5 6 9 10 2 // 1 2 5 6 11 12 3 // 1 2 5 9 18 19 4 // 1 2 6 10 17 20 5 // 1 2 7 8 9 10 6 // 1 2 7 8 11 12 7 // 1 2 7 11 19 20 8 // 1 2 8 12 17 18 9 // 1 2 17 18 19 20 10 // 1 5 9 10 14 15 11 // 1 5 11 12 14 15 12 // 1 10 14 15 17 20 13 // 2 6 9 10 13 16 14 // 2 6 11 12 13 16 15 // 2 9 13 16 18 19 16 // 3 4 5 6 9 10 17 // 3 4 5 6 11 12 18 // 3 4 5 9 18 19 19 // 3 4 6 10 17 20 20 // 3 4 7 8 9 10 21 // 3 4 7 8 11 12 22 // 3 4 7 11 19 20 23 // 3 4 8 12 17 18 24 // 3 4 17 18 19 20 25 // 3 7 9 10 15 16 26 // 3 7 11 12 15 16 27 // 3 12 15 16 17 18 28 // 4 8 9 10 13 14 29 // 4 8 11 12 13 14 30 // 4 11 13 14 19 20 31 // 9 10 13 14 15 16 32 // 11 12 13 14 15 16 15:40:07 |
|
豊川市
9月10日(金) 16:14:15
MAIL:fttnm528@ybb.ne.jp 50835 |
|
「数学」小旅行 |
|
#50834 自己レスです。
漸化式の証明をしてみました。 https://chafima.org/sansu/s1183/sansu1183.jpg |
|
9月10日(金) 17:58:13
50836 |
|
いちごみるく |
|
#50836
なるほど勉強になりました。 最近この手の問題は状態をbitでもって行列累乗で解く方法ばかり考えてしまいます。。。 |
|
9月10日(金) 19:15:53
50837 |
|
SECOND |
|
!少し くどいかもしれないが、、こんな漸化式も、、
!a(n)*(-1)^n = (1-T(n+1,-2))/3 ← 元の式を、 変形して→ T(n+1,-2)= 1-3*a(n)*(-1)^n !T(n,x)= 2*x*T(n-1,x)-T(n-2,x) ← チェビシェフ多項式の !T(n,-2)= -4*T(n-1,-2)-T(n-2,-2) x=-2 の状態に代入して、T(,) を消去すると、 ! a(n) = 2*(-1)^n + 4*a(n-1) - a(n-2) になった。 FOR n=0 TO 25 IF MOD(n,5)=0 THEN PRINT CHR$(13);CHR$(10);"!"; PRINT " a(";STR$(n);")=";a(n); NEXT n FUNCTION a(n) IF n=0 THEN LET a=1 ELSEIF n=1 THEN LET a=2 ELSE LET a=2*(-1)^n +4*a(n-1) -a(n-2) END IF END FUNCTION ! a(0)= 1 a(1)= 2 a(2)= 9 a(3)= 32 a(4)= 121 ! a(5)= 450 a(6)= 1681 a(7)= 6272 a(8)= 23409 a(9)= 87362 ! a(10)= 326041 a(11)= 1216800 a(12)= 4541161 a(13)= 16947842 a(14)= 63250209 ! a(15)= 236052992 a(16)= 880961761 a(17)= 3287794050 a(18)= 12270214441 a(19)= 45793063712 ! a(20)= 170902040409 a(21)= 637815097922 a(22)= 2380358351281 a(23)= 8883618307200 a(24)= 33154114877521 ! a(25)= 123732841202882 |
|
9月12日(日) 5:38:33
50838 |
|
ばち丸 |
|
下からn段目までの並べ方をa(n)とすると
a(0)=1、a(1)=2 a(2)=a(1)×2+a(0)×5 a(3)=a(2)×2+a(1)×5+a(0)×4 よりa(3)=32となりました。ちなみに a(n+1)=2a(n)+5a(n-1)+4a(n-2)+4a(n-3)+・・・+4a(0) になりそうです。これをn+2の分まで全く同様に考えて差を取ると #50836 「数学」小旅行さんの言われる漸化式が確かに出て来ます。 特性方程式の解が3つの異なる実解なので解析的に解けそうですね。 ところで教えて下さい。プログラミング初心者です 皆さんは何の言語でプログラミングをされておられるのでしょうか? |
|
9月12日(日) 8:52:55
50839 |
|
まるケン |
|
遅ればせながら、、、
皆様の漸化式導出、お見事です。 漸化式となればRubyのhashをつかったワンライナー!! ばち丸さん版 ruby -e "p Hash.new{|h,k|h[k]=k<2?k+1:h[k-1]*2+h[k-2]*5+(0..(k-3)).to_a.map{|i|h[i]*4}.sum}[3]" 「数学」小旅行さん版 ruby -e "p ans1183 = Hash.new{|h,k|h[k]=k<3?[1,2,9][k]:h[k-1]*3+h[k-2]*3-h[k-3]}[3]" ちなみに、最後の'3' を '100' とかにしてみたところ、ほぼ一瞬で 973982268352541414052113719150019529368114685310614630841 って出ました。 恐るべし漸化式、恐るべしhash!! |
|
9月12日(日) 15:42:42
50840 |
|
まるケン |
|
先ほどの「数学」小旅行さん版、ちょっと余計なのが入っちゃってました。
失礼いたしました。 「数学」小旅行さん版 ruby -e "p Hash.new{|h,k|h[k]=k<3?[1,2,9][k]:h[k-1]*3+h[k-2]*3-h[k-3]}[3]" とさらに短くなりました!! 余計だった部分は、実験時に ans1183 = Hash.new{|h,k|h[k]=k<3?[1,2,9][k]:h[k-1]*3+h[k-2]*3-h[k-3]} p ans1183[3] p ans1183[100] などと書いて、任意のnの値を求めていた名残です。 ところで、#50839 の最後の問いかけ、、、 > 皆さんは何の言語でプログラミングをされておられるのでしょうか? 今更答えるまでもなく、私の場合はもっぱら Ruby です。 ・スクリプト言語なので、コンパイル(ビルド)せずに即実行できる。 ・整数はメモリさえ許せば何桁でも計算できる! ・日本発の言語なので、日本語ドキュメントが豊富(英語、苦手です) などの理由で気に入っています。 |
|
9月12日(日) 16:02:24
50841 |
|
SECOND |
|
#50838 訂正、「チェビシェフ多項式」を、→「チェビシェフ多項式の漸化式」に読み替えてください、すみません。確認用に添えたプログラム言語は、十進BASIC です。
|
|
9月12日(日) 22:49:55
50842 |
|
ばち丸 |
|
皆々様 #50842、#50841
参考になりました。ありがとうございます。とりあえずお礼まで |
|
9月12日(日) 23:05:33
50843 |
|
「数学」小旅行 |
|
#50841 まるケン様
すごい、p Hash.new{|h,k|h[k]=k<3?[1,2,9][k]:3*h[k-1]+3*h[k-2]-h[k-3]}[100] ほんと、一瞬ですね。Hashの威力!!感激です。ありがとうございました。 |
|
9月13日(月) 7:51:25
50844 |
|
まるケン |
|
私の環境では 984 が限界で、985 を指定すると「stack level too deep」ってなります。
でも、一回このhashを変数に代入し、小刻みに計算させれば 100000 でも数秒で結果が出ました。 −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− # 漸化式を表したhashを作成、変数 ans1183 に代入 ans1183 = Hash.new{|h,k|h[k]=k<3?[1,2,9][k]:h[k-1]*3+h[k-2]*3-h[k-3]} # スタックが溢れない程度(900ずつ)に刻んで、hashを計算(計算するだけで表示はしない) 0.step(100000,900).each do |n| ans1183[n] end # 改めて、100000の値を計算 & 結果表示 r = ans1183[100000] p r # 文字列に変換して桁数表示 p r.to_s.size −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ちなみに最後に表示される桁数は 57195桁。 これくらいになると、今度はメモリ不足でHDアクセスが増え、計算スピードがめちゃくちゃ落ちます。 ま、そりゃそうですね。 |
|
9月13日(月) 10:33:32
50845 |
|
「数学」小旅行 |
|
#50821 pnae さん
「3×3行列の累乗に{1,0,0}をかける・・・」というのを考えてました。 漸化式を計算するのと同値なことができるようなので、Rubyの行列計算を使いました。 require 'matrix' n=5 m=Matrix[[0,0,-1],[1,0,3],[0,1,3]] k=Matrix[[1,2,9]] p (k*m**(n-2)*Matrix[[0],[0],[1]])[0,0] nの値として、高さの値を入れて計算できます。 |
|
9月13日(月) 11:39:00
50846 |
|
「数学」小旅行 |
|
しつこくてすみません。ワンライナーにこだわって、直前のプログラムを
書き換えますと、 require 'matrix' p (Matrix[[1,2,9]]*Matrix[[0,0,-1],[1,0,3],[0,1,3]]**(1))[0,2] require matrixで 1行 要るのが残念です。 |
|
9月13日(月) 12:13:02
50847 |
|
「数学」小旅行 |
|
#50845
require 'matrix' p (Matrix[[1,2,9]]*Matrix[[0,0,-1],[1,0,3],[0,1,3]]**(1000000))[0,2].to_s.size で、1,000,000 にしてみました。0.41秒(by paiza.IO)で、571,949桁って!! 単純計算はさすがに速いです。メモリーの心配もないのかも。 |
|
9月13日(月) 12:24:10
50848 |
|
まるケン |
|
実行時のコマンドライン引数にrequireを書いちゃえば、スクリプト自体はワンラインですね!!
ruby -r matrix -e 'p (Matrix[[1,2,9]]*Matrix[[0,0,-1],[1,0,3],[0,1,3]]**(1))[0,2]' 再帰じゃない、& hashじゃないので途中のデータを取っておく必要もないのでメモリをそんなに食わない!? 10,000,000 でも10秒もかからず結果が出ましたよ!すごい!! |
|
9月13日(月) 13:35:24
50849 |
|
「数学」小旅行 |
|
楽しみました。ありがとうございました。
またこんな問題をお願いします。=>マサル様 |
|
9月13日(月) 16:24:09
50850 |