Last active
October 2, 2018 18:19
-
-
Save oisincar/13b37870ef53736e09870a181700239f to your computer and use it in GitHub Desktop.
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
#include <bits/stdc++.h> | |
using namespace std; | |
int main() { | |
double score = 0; | |
for (int i = 0; i < 2048; i++) { | |
string st = ""; | |
for (int s = 0; s <= 10; s++) { | |
if ((i >> s) % 2) { | |
st += "1"; | |
} | |
else { | |
st += "0"; | |
} | |
} | |
cout << st << endl; | |
// score | |
double val = 0; | |
for (int s = 1; s <= 10; s++) { | |
if (st[s] == '1' && st[s-1] == '0') { | |
val++; | |
} | |
} | |
double top = 1; | |
double bot = 1; | |
for (int s = 0; s <= 10; s++) { | |
if (st[s] == '0') { | |
// 0.25; | |
bot *= 4; | |
} | |
else { | |
// 0.75 | |
top *= 3; | |
bot *= 4; | |
} | |
} | |
cout << top/bot << " " << val << endl; | |
score += val * top / bot; | |
} | |
cout << score << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment