Skip to content

Instantly share code, notes, and snippets.

@itsPG
Last active January 4, 2016 09:28
Show Gist options
  • Save itsPG/8601862 to your computer and use it in GitHub Desktop.
Save itsPG/8601862 to your computer and use it in GitHub Desktop.
/*
勝率70%的話,打競技場十勝以上的機率是25%左右,12勝機率是16%
拿實況主hcm的戰績來驗證一下想法
改版後參加競技場次數:73, win:497, lose:209, 勝率70.5%
十勝以上次數:19次,12勝次數:8次
按照機率算:
參加次數73次的話,約有18.25次可以拿到十勝以上,11.68次可以拿到12勝
而實際次數分別是19次以及8次
不可否認勝率打到後面會越來越低因此12勝的機率會比預測的少
但至少10勝的數字沒有偏離預測太多...
*/
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
vector<string> slot[13];
double p_slot[13] = {0};
double win_rate = 0.6, lose_rate = 1 - win_rate;
void dfs(string q, int w, int l)
{
if (w >= 12 || l >= 3)
{
slot[w].push_back(q);
p_slot[w] += pow(win_rate, w) * pow(lose_rate, l);
return ;
}
dfs(q + "1", w + 1, l);
dfs(q + "0", w, l + 1);
}
int main()
{
dfs("", 0, 0);
double chk_point = 0;
for (int i = 0; i < 13; i++)
{
cout << p_slot[i] << endl;
chk_point += p_slot[i];
}
cout << "chk_point " << chk_point << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment