http://acm.hdu.edu.cn/showproblem.php?pid=4438
简单题
代码:
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #include<set> #include<queue> #include<map> #include<string> #include <iomanip> using namespace std; #define LL long long const int INF=0x3f3f3f3f; int main() { //freopen("data.txt","r",stdin); int n; cin>>n; while(n--) { double x,y; double P,Q; cin>>x>>y>>P>>Q; //cout<<x<<" "<<y<<" "<<P<<" "<<Q<<endl; double tiger=x*(1.0-Q)+Q*(P*x+P*y); double wolf=Q*y+(1.0-Q)*(P*y+P*x); if(tiger>wolf) { printf("tiger %.4lf\n",tiger); }else { printf("wolf %.4lf\n",wolf); } } return 0; }