UVA 10056 What is the Probability?

题目描述

在这里插入图片描述

概率问题

在这里插入图片描述

#include<iostream>
#include<cmath>
using namespace std;
int main(){
    
    
	int s;
	cin>>s;
	int n;
	double p;
	int i;
	while(s--){
    
    
		cin>>n>>p>>i;
		double pro=(p*pow(1-p,i-1))/(1-pow(1-p,n));		
		printf("%.4lf\n",pro);
	
}
}

猜你喜欢

转载自blog.csdn.net/qaqaqa666/article/details/112919218