题目链接:uva 11346 - Probability
题目大意:给定x,y的范围,以及s,问说在该范围内选取一点,和x,y轴形成图形的面积大于s的概率。
解题思路:首先达到方程xy ≥ s,即y = s / x。

S2的面积用积分计算,y = s / x的原函数为lnx
所以S2=s?(ln(a)?ln(x))
#include
#include
#include
#include
using namespace std; int main () { int cas; double a, b, s; scanf("%d", &cas); while (cas--) { scanf("%lf%lf%lf", &a, &b, &s); double r = min(s / b, a); double ans = r * b + log(a) * s; if (fabs(s) > 1e-9) ans = ans - log(r) * s; double p = 1 - ans / (a * b); printf("%.6lf%c\n", fabs(p * 100), '%'); } return 0; }