Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int t;
- cin >> t;
- while(t--){
- int n, k;
- double p;
- cin >> n >> p >> k;
- if(p == 1.000000){
- if(k == 1){
- cout << fixed << setprecision(4) << 1.0 << "\n";
- } else if(n > 1 && k > 1){
- cout << fixed << setprecision(4) << 0.0 << "\n";
- }
- }
- else{
- double tp = (p*pow(1-p, k-1))/(1-pow(1-p, n));
- cout << fixed << setprecision(4) << tp << "\n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement