题意:。。
思路:直接算出公式。。注意 p=0 的情况
#include<bits/stdc++.h>
using namespace std;
#define SPEED_UP iostream::sync_with_stdio(false);
#define FIXED_FLOAT cout.setf(ios::fixed, ios::floatfield);
#define rep(i, s, t) for(int (i)=(s);(i)<=(t);++(i))
#define urep(i, s, t) for(int (i)=(s);(i)>=(t);--(i))
typedef long long LL;
const int Maxn = 50;
int t, n, k;
double p;
int main() {
#ifndef ONLINE_JUDGE
freopen("input.in", "r", stdin);
#endif
SPEED_UP
FIXED_FLOAT
cin >> t;
while (t--) {
cin >> n >> p >> k;
if (p == 0) {
cout << "0.0000" << endl;
continue;
}
double q = pow(1-p, n);
double ans = pow(1-p, k-1) * p / (1-q) ;
cout << setprecision(4) << ans << endl;
}
return 0;
}