zoj3335

题目链接:

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3860

Football Gambling I

Time Limit: 1 Second       Memory Limit: 65536 KB

The 2010 FIFA World Cup toke place between 11 June and 11 July 2010 in South Africa. Being a non-fans, asmn likes football gambling more than the football match itself. Of course, he won't use real money, he just gamble on the renren.com for fun using the virtual gold coin.

The rule of football gambling is simple. The bookmaker display three decimal numbers abc before the match between team X and team Y. Number a is the odds for team X will win the game. Number b is the odds for they will get a draw. Number c is the odds for team X will lose the game.

Odds means that if you bet x gold coins, you will get floor(odds * x) gold coins in total if you guess the right result, or you will get nothing.

The Odds of the online gambling is higher than that in the real gambling because the gold coins are virtual. After several gambling, asmn found that, sometimes the odds are too high that it is possible to find a way to bet on three result at the same time, so that he can win money whatever the result is.

Now, given the odds of some matchs, you are to determine weather such a way exists.Assuming that asmn has enough gold coins before each gambling.

Input

The input consists of N cases. The first line of the input contains a positive integer N(N <= 10000). Each case contains three decimal numbers ab and c (1 < ab,c < 100), the meaning of which is described above. Each decimal number will have exactly two digits after the decimal point.

Output

For each case, if you can win money in the worst case, you should output "Aha" in a line, else you should output "No way" instead.

Sample Input
3
3.30 3.30 3.30
2.00 3.00 7.00
3.00 3.00 3.00
Sample Output
Aha
Aha
No way
Hint
证明如下:

如果要稳赚不赔,则满足如下条件

m*x+n*x+z*x=x,

则出现任何一种情况都要赢的话,则必须满足

a*m*x>x&&b*n*x>x&&c*z*x*>x

则m>1/a&&n>1/b&&z>1/c

又m+n+z=1;则1/a+1/b+1/c<1则稳赚不赔。。

故代码为:

#include<cstdio>
int main()
{
    double a,b,c;
    int t;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%lf%lf%lf",&a,&b,&c);
        if(((b*c)+(a*b)+(a*c))/(a*b*c)<1.0)
            printf("Aha\n");
        else
            printf("No way\n");
    }
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值