(あとで)
double dp[2][210][110][110]; int main() { //ios::sync_with_stdio(false); ll N, D; int tb[]={ 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 1, 1, 1, 0, }; while(cin>>N>>D) { int p2=0, p3=0, p5=0; while(D%2==0) p2++,D/=2; while(D%3==0) p3++,D/=3; while(D%5==0) p5++,D/=5; if(D>1) { cout<<0<<endl; continue; } // cout<<p2<<" "<<p3<<" "<<p5<<endl; int men=0; REP(m, 2) REP(i, 210) REP(j, 110) REP(k, 110) dp[m][i][j][k]=0; dp[men][0][0][0] = 1; REP(I, N) { REP(i, 210) REP(j, 110) REP(k, 110) { if(dp[men][i][j][k]==0.0) continue; REP(me, 6) { int ni = i+tb[me*3+0]; int nj = j+tb[me*3+1]; int nk = k+tb[me*3+2]; if(ni<210 && nj<110 && nk<110) dp[1-men][ni][nj][nk] += dp[men][i][j][k] / 6.0; } } REP(i, 210) REP(j, 110) REP(k, 110) dp[men][i][j][k]=0; men ^= 1; // PRINT3(dp, 5, 5, 1); } double ans = 0; REP(i, 210) REP(j, 110) REP(k, 110) if(i>=p2 && j>=p3 && k>=p5) ans += dp[men][i][j][k]; cout<<ans<<endl; } return 0; }
double f(double EP, double EQ) { return 1.0 / (1 + pow(10, (EQ-EP)/400)); } int main() { //ios::sync_with_stdio(false); ll K; while(cin>>K) { VI E(1<<K); REP(i, 1<<K) cin>>E[i]; vector<double> p(1<<K, 1), np(1<<K); REP(round, K) { int size = 1<<round; int games = (1<<K)/size/2; // cout<<"round: "<<size<<" "<<games<<endl; REP(game, games) { int asidx = game*size*2; int bsidx = game*size*2+size; REP(ai, size) { REP(bi, size) { double pawin = f(E[asidx+ai], E[bsidx+bi]); np[asidx+ai] += p[asidx+ai]*p[bsidx+bi]*pawin; np[bsidx+bi] += p[asidx+ai]*p[bsidx+bi]*(1-pawin); } } } // cout<<"np: "<<np<<endl; p = np; np = vector<double>(1<<K); } REP(i, 1<<K) cout<<p[i]<<endl; } return 0; }