您的位置:首页 > 其它

hdu 4438 Hunters(数学期望)

2014-10-27 11:38 423 查看
水题。

代码:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
using namespace std;
#define LL long long
#define eps 1e-6
double X,Y,P,Q;
int main(){
	int T;
	cin>>T;
	while(T--){
		scanf("%lf%lf%lf%lf",&X,&Y,&P,&Q);
		double t1=(X+Y)*P*Q+X*(1-Q);
		double t2=(X+Y)*P*(1-Q)+Y*Q;
		bool flag=0;
		double res;
		if(t1>t2-eps){
			flag=0;
			res=t1;
		}
		else {
			flag=1;
			res=t2;
		}
		if(flag)cout<<"wolf ";
		else cout<<"tiger ";
		printf("%.4f\n",res);
	}
	return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: