高校数学の質問スレ(医者・東大卒専用) Part438 (979レス)
高校数学の質問スレ(医者・東大卒専用) Part438 http://rio2016.5ch.net/test/read.cgi/math/1723152147/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
必死チェッカー(本家)
(べ)
自ID
レス栞
あぼーん
472: 132人目の素数さん [sage] 2024/12/28(土) 12:26:13.98 ID:ABHDoLY/ 横綱、大関、関脇で巴戦を行う。 2力士が対戦して,勝った方が残りの 1 力士と対戦をする。 これを繰り返して,2連勝した力士が優勝をする。 勝利確率は通算成績に従うとする(巴戦での成績も組み入れて計算する) 巴戦前の通算成績は 横綱 対 大関は 横綱の10勝9負 大関 対 関脇は 大関の 8勝7負 横綱 対 関脇は 横綱の 6勝5負 とする。 大関 対 関脇で巴戦を始めるときにそれぞれの力士の優勝する確率を算出しなさい。 http://rio2016.5ch.net/test/read.cgi/math/1723152147/472
473: 132人目の素数さん [sage] 2024/12/28(土) 12:27:13.74 ID:ABHDoLY/ sim=\(){ h12=c(10,9) # bout3 h23=c(8,7) # bout1 h13=c(6,5) # bout2 bout=1 last_winner=0 flg= FALSE count=0 while(!flg){ count=count+1 if(bout==1){ i=2-rbinom(1,1,h23[1]/sum(h23)) h23[i]=h23[i]+1 winner=c(2,3)[i] bout=c(2,3)[-i] } if(bout==2){ i=2-rbinom(1,1,h13[1]/sum(h13)) h13[i]=h13[i]+1 winner=c(1,3)[i] bout=c(1,3)[-i] } if(bout==3){ i=2-rbinom(1,1,h12[1]/sum(h12)) h12[i]=h12[i]+1 winner=c(1,2)[i] bout=c(1,2)[-i] } flg <- winner==last_winner last_winner=winner } c(winner=winner,count=count) } t(replicate(100,sim())) http://rio2016.5ch.net/test/read.cgi/math/1723152147/473
474: 132人目の素数さん [sage] 2024/12/28(土) 12:43:10.85 ID:ABHDoLY/ sim=function(){ h12=c(10,9) # bout3 横綱1vs大関2 h23=c(8,7) # bout1 大関2vs関脇3 h13=c(6,5) # bout2 横綱1vs関脇3 bout=1 # 初戦の試合番号 last_winner=0 # 前勝者 flg= FALSE # 連勝フラッグ count=0 # 試合数 while(!flg){ count=count+1 if(bout==1){ i=2-rbinom(1,1,h23[1]/sum(h23)) # 勝者のindex h23[i]=h23[i]+1 # 通算成績更新 winner=c(2,3)[i] # 勝者番号 bout=c(2,3)[-i] # 敗者番号=次の試合番号 } if(bout==2){ i=2-rbinom(1,1,h13[1]/sum(h13)) h13[i]=h13[i]+1 winner=c(1,3)[i] bout=c(1,3)[-i] } if(bout==3){ i=2-rbinom(1,1,h12[1]/sum(h12)) h12[i]=h12[i]+1 winner=c(1,2)[i] bout=c(1,2)[-i] } flg <- winner==last_winner last_winner=winner } c(winner=winner,count=count) } t(replicate(100,sim())) http://rio2016.5ch.net/test/read.cgi/math/1723152147/474
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
1.344s*