概率问题,题目不是很难。
题意:在给定的【-a,a】 * 【-b,b】内随机取一个点 面积ab > s的概率
#include <cstdio>
#include <cmath>
int main() {
int T;
double a, b, s;
scanf("%d", &T);
while (T--) {
scanf("%lf%lf%lf", &a, &b, &s);
if (a * b <= s) {
puts("0.000000%");
continue;
}
if (s == 0) {
puts("100.000000%");
continue;
}
double c=s/b;
printf("%f%%\n",100-100*(s*(log(a)-log(c))+b*c)/a/b);
}
return 0;
}