您的位置:首页 > 其它

HDU 4438 Hunters(模拟)

2014-03-30 22:23 302 查看
题目链接:HDU 4438 Hunters

模拟。

很简单的题目,两种情况(Alice先选tiger或者Alice先选wolf)算出来比一下大小就行了。

#include <iostream>
#include <iomanip>

using namespace std;

int t, x, y;
double p, q;
double tiger, wolf;

int main()
{
    cin >> t;
    while(t--)
    {
        cin >> x >> y >> p >> q;
        tiger = q * (x * p + y * p) + (1.0 - q) * x;
        wolf = q * y + (1.0 - q) * (x * p + y * p);
        if(tiger > wolf)
        {
            cout << "tiger ";
            cout << fixed << setprecision(4) << tiger << endl;
        }
        else
        {
            cout << "wolf " ;
            cout << fixed << setprecision(4) << wolf << endl;
        }
    }
    return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: