求助,70分卡在1,3,4这几个点了
#include <bits/stdc++.h>
using namespace std;
#define limit (10000 + 5)//防止溢出
#define INF 0x3f3f3f3f
#define inf 0x3f3f3f3f3f
#define lowbit(i) i&(-i)//一步两步
#define EPS 1e-6
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ff(a) printf("%d\n",a );
#define pi(a,b) pair<a,b>
#define rep(i, a, b) for(int i = a; i <= b ; ++i)
#define per(i, a, b) for(int i = b ; i >= a ; --i)
#define mint(a,b,c) min(min(a,b), c)
#define MOD 998244353
#define FOPEN freopen("C:\\Users\\tiany\\CLionProjects\\acm_01\\data.txt", "rt", stdin)
typedef long long ll;
typedef unsigned long long ull;
ll read(){
ll sign = 1, x = 0;char s = getchar();
while(s > '9' || s < '0' ){if(s == '-')sign = -1;s = getchar();}
while(s >= '0' && s <= '9'){x = x * 10 + s - '0';s = getchar();}
return x * sign;
}//快读
void write(ll x){
if(x < 0) putchar('-'),x = -x;
if(x / 10) write(x / 10);
putchar(x % 10 + '0');
}
int n,m,k,tot;
int a[limit];
double dp[limit][100 + 5];//做i道对j道的
int main() {
#ifdef LOCAL
FOPEN;
#endif
n = read(),m = read(), k = read();
double p = 1.0 * m / 100;//概率
double np = 1 - p;
rep(i ,1,n){
char c;
scanf("%c" , &c);
a[i] = c - '0';
}
if(!k && n > 50)
return 0 * puts("1.000");
dp[0][0] = 1.00;
rep(i ,1, n){//从上一题过来然后写错
dp[i][0] = dp[i - 1][0] * (a[i] ? np : p);//
}
rep(i ,1, n){
rep(j ,1, i){
if(!a[i])dp[i][j] = dp[i - 1][j] * p + dp[i - 1][j - 1] * np;//如果不一样就是要么上一题的时候做错了,
else dp[i][j] = dp[i - 1][j] * np + dp[i - 1][j - 1] * p;
}
}
// rep(i ,1, n){
// rep(j ,1, i){
// printf("at %d and %d we have%lf ",i,j, dp[i][j]);
// }
// cout<<endl;
// }
double ans = 0.0000;
per(i , k , n){
ans += dp[n][i];
}
printf("%.3lF", ans);
return 0;
}