您的位置:首页 > 其它

hdu 4438 推公式求概率水题

2015-03-07 10:50 253 查看
水死了,秒切的题....

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

typedef long long LL;

int t;
LL x,y;
double p,q;
double ans1,ans2;

int main ( )
{
    scanf ( "%d" , &t );
    while ( t-- )
    {
        scanf ( "%lld%lld" , &x , &y );
        scanf ( "%lf%lf" , &p , &q );
        ans1 = q*p*(x+y) + (1-q)*x;
        ans2 = q*y + (1-q)*p*(x+y);
        if ( ans1 > ans2 )
            printf ( "tiger %.4lf\n" , ans1 );
        else 
            printf ( "wolf %.4lf\n" , ans2 );
    }
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: