hdu 4438

来源:互联网 发布:老司机 知乎 收藏夹 编辑:程序博客网 时间:2024/05/21 09:24

比较水的概率题;写出公式即可

#include <iostream>#include <stdio.h>#include <string>#include <string.h>#include <algorithm>using namespace std;int main(){    int T;    scanf("%d",&T);    while(T--)    {        double  x,y,p,q;        scanf("%lf%lf%lf%lf",&x,&y,&p,&q);        double tmp1=((1-q)+1.0*q*p*(1-p))*x;               tmp1+=1.0*q*(1-p)*p*y;               tmp1+=1.0*q*p*p*(x+y);        double tmp2=(1-q)*(1-p)*p*x;               tmp2+=(q+(1-q)*p*(1-p))*y;               tmp2+=(1-q)*p*p*(x+y);        if(tmp1>tmp2)        {           printf("tiger %.4lf\n",tmp1);        }        else           printf("wolf %.4lf\n",tmp2);    }    return 0;}
0 0