本题我想求组合数C 发现 C(2000,1000)太大。
于是比赛没做出来。。。。
结果居然只是dp!!
很有道理。。。下次注意
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include<iostream>
#include<cmath>
#include<cctype>
#include<ctime>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=next[p])
#define Lson (x<<1)
#define Rson ((x<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define MAXN (2000+10)
#define eps (1e-7)
long long mul(long long a,long long b){return (a*b)%F;}
long long add(long long a,long long b){return (a+b)%F;}
long long sub(long long a,long long b){return (a-b+(a-b)/F*F+F)%F;}
typedef long long ll;
int n,t;
double p;
long double f[MAXN][MAXN]={0};
int main()
{
// freopen("Escalator.in","r",stdin);
// freopen(".out","w",stdout);
cin>>n>>p>>t;
if (n>=t)
{
cout<<p*t<<endl;
return 0;
}
f[0][0]=1;
Rep(i,t+1)
Rep(j,min(i,n)+1)
{
if (j==n) f[i+1][j]+=f[i][j];
else
{
f[i+1][j+1]+=f[i][j]*p;
f[i+1][j]+=f[i][j]*(1-p);
}
}
double ans=0;
Rep(j,n+1) ans+=f[t][j]*min(j,n);
printf("%.10lf\n",ans);
return 0;
}