#define BETA 2.05
#define BETB 2.8
#define TAXRATE 0.2
#define CASHA 83176
#define CASHB 86
// Team A is more likely to win
// Person A has more cash
#include <stdio.h>
int main(int argc, const char * argv[])
{
double winChanceA=(1.0/BETA)/(1.0/BETA+1.0/BETB);
double winChanceB= 1.0 - winChanceA;
int aToB;
for (aToB=(-1*CASHB); aToB<CASHA; aToB++) {
double winAmountA;
double winAmountB;
double taxDeduct1 = TAXRATE * (double)aToB ;
winAmountA=(CASHA-aToB)*(BETA-1)-(CASHB+aToB*(1-TAXRATE))-TAXRATE*aToB;
winAmountB=(CASHB+aToB*(1-TAXRATE))*(BETB-1)-(CASHA-aToB)-TAXRATE*aToB;
double totalWin=winChanceA*winAmountA+winChanceB*winAmountB;
if ((winAmountA>0)&&(winAmountB>0)) {
printf("A wins %5.1f , B wins %5.1f, total %5.1f, aToB %d\n",winAmountA,winAmountB,totalWin,aToB);
}
}
printf("ratio %3.1f\n",(winChanceB/winChanceA));
}
叫我红领巾 |