Last active
November 12, 2017 01:58
-
-
Save balamark/062c0221c134d47da5da7b55197af7c5 to your computer and use it in GitHub Desktop.
incorrect solution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// was trying to sum up Pa + Pb_selective {2,3,17} but the probability that both team score a prime should | |
// be calculated this way pA * pB | |
double getProbability(int skillOfTeamA, int skillOfTeamB) { | |
vector<int> aWin = {2,3,5,7,11,13,17}, bWin = {2,3,17}; | |
double ret, pa = skillOfTeamA/100.0, pb = skillOfTeamB/100.0; | |
for(int d : aWin) | |
ret += pow(pa, d)*pow(pb,(18-d))*C(18, d); | |
for(int d: bWin) | |
ret += pow(pb, d)*pow(pa,(18-d))*C(18, d); | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment