uva 10056 What is the Probability ?(简单概率)
2014-12-28 17:08
399 查看
题意:。。
思路:直接算出公式。。注意 p=0 的情况
思路:直接算出公式。。注意 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; }
相关文章推荐
- uva 10056 What is the Probability ? 概率是多少
- uva10056 - What is the Probability ?(概率是多少)
- UVA10056 - What is the Probability ?(概率)
- UVA 10056 - What is the Probability ?(概率)
- UVA - 10056 What is the Probability ? 概率UVA - 10056 What is the Probability ?
- UVa 10056 What is the Probability ? (概率&有一个陷阱)
- uva 10056 - What is the Probability ?(概率)
- What is the Probability - UVa 10056 概率
- UVA - 10056 What is the Probability ?(概率)
- uva 10056 - What is the Probability ?(概率)
- UVA - 10056 What is the Probability
- UVA 10056 What is the Probability ?
- UVA - 10056 What is the Probability ?
- UVA 10056 What is the Probability ?
- uva 10056 What is the Probability ?
- uva 10056 - What is the Probability ?
- uva 10056 What is the Probability?
- UVA - 10056 What is the Probability ?
- UVa 10056 - What is the Probability ?(等比数列求极限)
- UVa 10056 — What is the Probability?