ACM/ICPC 2012 天津 - HDU 4438 - 算概率


题解:简单算下概率即可

#include<cstdio>

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


你可能感兴趣的:(ACM/ICPC 2012 天津 - HDU 4438 - 算概率)