水死了,秒切的题....
#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 );
}
}