hdu(4438)

题目: http://acm.hdu.edu.cn/showproblem.php?pid=4438
2012亚洲区天津站的一道题,求期望问题,推出公式就解了,注意当Alice和Bob选择相同的时候,他们同时猎杀一只之后又同时去猎杀另一只。

#include 
int main(){
    int t;
    scanf("%d",&t);
    while(t--){
       doublex,y,p,q;
       scanf("%lf%lf%lf%lf",&x,&y,&p,&q);
       double tiger= q*p*(x+y) + (1-q)*x;
       double wolf= q*y + (1-q)*p*(x+y);
       if(tiger> wolf)
          printf("tiger %.4lf\n",tiger);
       else
          printf("wolf %.4lf\n",wolf);
    }
    return 0;
}


你可能感兴趣的:(数论)