POJ - 1561
#include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;
int main()
{
int T;
double p,q,tot,co;
double c[100][100];
scanf("%d",&T);
while (T--)
{
scanf("%lf",&p); q=1-p;
tot=0;
for (int k=43;k<=86;k++)
{
co=pow(p,44)*pow(q,k-43);
c[0][0]=co;
for (int i=1;i<=k;i++)
c[i][0]=c[i][i]=co;
for (int i=1;i<=k;i++)
for (int j=1;j<=43;j++)
c[i][j]=c[i-1][j-1]+c[i-1][j];
tot+=c[k][43];
}
printf("%.6f\n",tot);
}
return 0;
}