今天是練習cpe的What is the Probability題目
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int S,N,i;
	double p;
	cin >> S;
	while(S--)
	{
		cin >> N >> p >> i;
		if(p == 0)
		{
			cout << 0.000 <<endl;
			continue;
		}
		double first = pow(1.0 - p, i-1)*p;
		double fall = pow(1.0 - p, N);
		cout << fixed << setprecision(4) << first / (1.0 - fall) << endl ;
	} 
   return 0;
}