HDU 4438 Hunters 区域赛水题

本文转载于 http://blog.csdn.net/major_zhang/article/details/52197538

2012天津区域赛最水之题:

题意容易读懂,然后就是分情况求出A得分的数学期望,所谓数学期望就是在该概率下的平均得分。

现在就是两种方案,Alice要根据输入给出的数据情况选出最优方案,也就是先选老虎,还是狼。

1.A先选老虎:

a.B也先选老虎,则得分为Q(P*X+P*Y);  //打完老虎还要打狼

b.B选狼,则两人可以直接获得猎物,则得分为(1-Q)*X

所以1方案Alice先选老虎的得分期望是a+b;(数学期望每种情况的概率加起来要为1,这里以Bob的选择情况为分水岭,容易得出)

2.A先选狼:

a.B先......

b.B先.....

然后比较A和B的得分期望那个高,就选哪种方案,另外输出也给出了提示,即选择Tiger和Wolf的得分情况。

#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int T;
    cin>>T;
    while(T--){

    double a,b;
    double x,y,p,q;
    cin>>x>>y>>p>>q;
    a=q*(p*x+p*y)+(1-q)*x;
    b=(1-q)*(p*x+p*y)+y*q;
    if(a>b)
        printf("tiger %.4f\n",a);
    else
        printf("wolf %.4f\n",b);
    }
    return 0;
}
时间: 2024-08-27 21:14:04

HDU 4438 Hunters 区域赛水题的相关文章

HDU 4463 Outlets (prime_杭州区域赛水题)

Problem Description In China, foreign brand commodities are often much more expensive than abroad. The main reason is that we Chinese people tend to think foreign things are better and we are willing to pay much for them. The typical example is, on t

hdu 1999 不可摸数 水题。

不可摸数 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7966    Accepted Submission(s): 2024 Problem Description s(n)是正整数n的真因子之和,即小于n且整除n的因子和.例如s(12)=1+2+3+4+6=16.如果任何数m,s(m)都不等于n,则称n为不可摸数. Input 包

HDU Senior&#39;s Gun (水题)

题意:给n把枪,m个怪兽,每把枪可消灭1怪兽,并获得能量=枪的攻击力-怪兽的防御力.求如何射杀能获得最多能量?(不必杀光) 思路:用最大攻击力的枪杀防御力最小的怪兽明显可获得最大能量.如果每把枪都去射杀刚好1点能量都拿不到的怪物,那简直等于把枪全丢掉. 1 //#pragma comment(linker,"/STACK:102400000,102400000") 2 #include <iostream> 3 #include <stdio.h> 4 #inc

HDU 5590 ZYB&#39;s Biology 水题

ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5590 Description ZYB(ZJ−267)在NOIP拿到600分之后开始虐生物题,他现在扔给你一道简单的生物题:给出一个DNA序列和一个RNA序列,问它们是否配对. DNA序列是仅由A,C,G,T组成的字符串,RNA序列是仅由A,C,G,U组成的字符串. DNA和RNA匹配当且仅当每

[暑假集训]区域赛套题集

2014-07-03 [浙江第11届省赛]ZOJ 3785 What day is that day?  (打表找循环节) [暑假集训]区域赛套题集

Heshen&#39;s Account Book HihoCoder - 1871 2018北京区域赛B题(字符串处理)

Heshen was an official of the Qing dynasty. He made a fortune which could be comparable to a whole country's wealth by corruption. So he was known as the most corrupt official in Chinese history. But Emperor Qianlong liked, or even loved him so much

2017年ICPC中国大陆区域赛真题(下)

2017年ICPC中国大陆区域赛真题(下) A - Lovers #include <bits/stdc++.h> using namespace std; const int maxn=2e5+10; int n,k,a[maxn],b[maxn],ans; int main() { int _; scanf("%d", &_); while (_--) { scanf("%d%d", &n, &k); for (int i =

hdu5080:几何+polya计数(鞍山区域赛K题)

/* 鞍山区域赛的K题..当时比赛都没来得及看(反正看了也不会) 学了polya定理之后就赶紧跑来补这个题.. 由于几何比较烂写了又丑又长的代码,还debug了很久.. 比较感动的是竟然1Y了.. */ 题目大意: 给定一些点,某些点上有边,问用k种颜色染色的等价类有多少种 思路: 由于坐标是整数..只有可能旋转90,180,270才能得到置换 且图形必须为中心对称图形 先用几何方法找出对称中心 然后旋转,找是否出现置换... 由于点数只有50,几何预处理这一部分可以很暴力无脑的写..各种判断相

hdu 4847 Wow! Such Doge! 水题

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4847 统计文本中一共有多少个“Doge” 水题 #include <cstring> #include <cstdlib> #include <cstring> #include <cmath> #include <algorithm> #include <iostream> #include <cstdio> #includ