用dp[i][j]表示在第i秒进入j人的概率 dp[i][j] += dp[i-1][j-1] * p; 当j == n且i > j时表示所有人都已进去则dp[i][j] += dp[i-1][j]否则dp[i][j] += dp[i-1][j] * (1-p)
#include <bits/stdc++.h>
#define maxn 2005
#define MOD 1000000007
using namespace std;
typedef long long ll;
double dp[maxn][maxn];
int main(){
// freopen("in.txt", "r", stdin);
int n, t;
double p;
scanf("%d%lf%d", &n, &p, &t);
dp[0][0] = 1;
for(int i = 1; i <= t; i++){
for(int j = 0; j <= min(i, n); j++){
if(j == 0){
dp[i][j] = dp[i-1][j] * (1 - p);
continue;
}
dp[i][j] += dp[i-1][j-1] * p;
if(j == n && i > j)
dp[i][j] += dp[i-1][j];
else
dp[i][j] += dp[i-1][j] * (1 - p);
}
}
double sum = 0;
for(int i = 1; i <= min(t, n); i++){
sum += dp[t][i] * i;
}
printf("%.6lf\n", sum);
return 0;
}