pyhon实现三羊问题
import random
x=0
kindout=[]
x=0
for i in range(0,100000):
kind=random.sample(['c','s','s'],3)
kindout=[]
choice=random.randint(0,2)
for j in range(len(kind)):
if j!=choice and kind[j]!="c":
kindout.append(kind[j])
kindout.append(kind[choice])
continue
if 'c' not in kindout:
x=x+1
print(x)