UVa 11346 - Probability

纯粹数学题,推公式吧。注意边界处理精度控制就可以了。

#include <cstdio>
#include <cmath>
#define EPS 1e-7
int main()
{
	int T; scanf("%d", &T);
	while (T--){
		double a, b, S; scanf("%lf %lf %lf", &a, &b, &S);
		if (S - a *b >= EPS) puts("0.000000%");
		else if (S <= EPS) puts("100.000000%");
		else printf("%f%%\n", (a *b - S - S * log(a * b / S)) / (a * b) * 100);
	}
	return 0;
}


posted @ 2015-03-03 23:26  Popco  阅读(122)  评论(0编辑  收藏  举报