世界杯投彩算法,不知写的对不对? 20
浏览:869 回答:1
program gambling parameter (w=1000000) real e(w) print*,"赢、平、输的赔率分别为:" read *, a,b,c print*,"2元/注,一共投注:" read *, y print *,"一共投注:",y,"投注本金:",2*y d=a+b+c max=0 do p=0,y do q=0,y-p do i=1,w x1=2*a*p-2*y x2=2*b*q-2*y x3=2*(y-p-q)*c-2*y e(i)=c/d*x1+b/d*x2+a/d*x3 if ((e(i).gt.max).and.((y-p-q).gt.0))then max=e(i) goto 10 endif enddo enddo 10 print *,"能赚到钱的期望:",max print *,"投赢的注数:",p print *,"投平的注数:",q print *,"投输的注数:",y-p-q enddo end
最近世界杯,本人突发奇想想编写一个如何投注都不会亏钱的算法,求大神们指点