Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include<iomanip>
- using namespace std;
- int main()
- {
- int s;
- while(cin>>s)
- {
- while(s>0)
- {
- int n=0,i=0;
- double p=0;
- cin>>n>>p>>i;
- double q=1-p;
- double ans=pow(q,i-1)*p/(1-pow(q,n));
- cout<<setprecision(4)<<ans<<endl;
- s--;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement