-
Notifications
You must be signed in to change notification settings - Fork 0
/
10056_WhatistheProbability.cc
73 lines (61 loc) · 1.08 KB
/
10056_WhatistheProbability.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
*
* Author : fcbruce <fcbruce8964@gmail.com>
*
* Time : Sun 11 Sep 2016 16:19:51
*
*/
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <algorithm>
#include <ctime>
#include <cctype>
#include <cmath>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <set>
#define sqr(x) ((x)*(x))
#ifdef _WIN32
#define lld "%I64d"
#else
#define lld "%lld"
#endif
const int INF = 0x3f3f3f3f;
const long long INFLL = 0x3f3f3f3f3f3f3f3fll;
const double PI = acos(-1.0);
const double eps = 1e-10;
typedef long long LL;
typedef int itn;
const int maxn = 0;
const int maxm = 0;
int main()
{
#ifdef FCBRUCE
freopen("/home/fcbruce/code/t", "r", stdin);
#endif // FCBRUCE
int T_T;
scanf("%d", &T_T);
while (T_T--)
{
int n, k;
double p;
scanf("%d%lf%d", &n, &p, &k);
if (p < eps) printf("%.4f\n", 0.);
else
{
double q = 1 - p;
p *= pow(q, k - 1);
q = pow(q, n);
double winp = p / (1 - q);
printf("%.4f\n", winp);
}
}
return 0;
}