根据对称性, 求出第一象限的概率就可以了。
令x * y = S, 则y = S / x。即 x * y > S的点在y = S / x上。概率为线上的面积 / (a * b)。
然后用积分求出下半部分面积。
#include <cstdio>
#include <cmath>
const double eps = 0.00001;
int main() {
int N;
scanf("%d", &N);
while(N--) {
double a, b, S;
scanf("%lf%lf%lf", &a, &b, &S);
if(S >= a * b - eps) printf("0.000000%%\n");
else if(S < eps) printf("100.000000%%\n");
else printf("%lf%%\n", (a * b - S - S * log(a * b / S)) / a / b * 100);
}
return 0;
}