HDU - 6245(思维)

One day, God Sheep would like to play badminton but he can’t find an opponent. So he request Mr. Panda to play with him. He said: “Each time I win one point, I’ll pay you XX dollars. For each time I lose one point, you should give me YY dollars back.”
God Sheep is going to play KK sets of badminton games. For each set, anyone who wins at least 11 points and leads by at least 2 points will win this set. In other words, normally anyone who wins 11 points first will win the set. In case of deuce (E.g. 10 points to 10 points), it’s necessary to lead by 2 points to win the set.
Mr. Panda is really good at badminton so he could make each point win or lose at his will. But he has no money at the beginning. He need to earn money by losing points and using the money to win points.
Mr. Panda cannot owe God Sheep money as god never borrowed money. What’s the maximal number of sets can Mr. Panda win if he plays cleverly?

Input

The first line of the input gives the number of test cases, TT. TT test cases follow.
Each test case contains 3 numbers in one line, XX, YY , KK, the number of dollars earned by losing a point, the number of dollars paid by winning a point, the number of sets God Sheep is going to play.
1≤T≤105.1≤T≤105.
1≤X,Y,K≤1000.1≤X,Y,K≤1000.

Output

For each test case, output one line containing “Case #x: y”, where xx is the test case number (starting from 1) and yy is the maximal number of sets Mr. Panda could win.

Sample Input

2
10 10 1
10 10 2

Sample Output

Case #1: 0
Case #2: 1

        
  

Hint

In the first test case, Mr. Panda don’t have enough money to win the only set, so he must lose the only set.
In the second test case, Mr. Panda can lose the first set by 0:11 and he can earn 110 dollars. Then winning the second set by 11:0 and spend 110 dollars.

题意:

羊和熊猫打k局羽毛球,每局的获胜者可以以11分:9分获胜,如果是平局,则需要不断进行比赛直到某人比其他人高出两分。羊赢一分需要给熊猫x元,熊猫赢一分需要给羊y元。熊猫可以随意决定这句的输赢,它一开始没有钱,并且熊猫不能欠羊的钱,问熊猫最多能赢几局?

(我没有想到的地方)如果x>y:熊猫肯定能赢每一局。赢一分输一分地比赛,慢慢攒钱,攒到能多两分。(我太菜了!!!!)

如果x<=y:熊猫需要以0:11输掉一局的比赛来攒钱。列一个不等式解就好了

太惨了 WA了4次

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int t,k,kcase=0;
    int x,y;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d%d%d",&x,&y,&k);
        int ans;
        if(x>y)
            ans=k;
        else
            ans=11*x*k/(2*x+11*y);
        cout<<"Case #"<<++kcase<<": "<<ans<<'\n';
    }
    return 0;
}

 

全部评论

相关推荐

最近群里有很多同学找我看简历,问问题,主要就是集中在明年三月份的暑期,我暑期还能进大厂嘛?我接下来该怎么做?对于我来说,我对于双非找实习的一个暴论就是title永远大于业务,你在大厂随随便便做点慢SQL治理加个索引,可能就能影响几千人,在小厂你从零到一搭建的系统可能只有几十个人在使用,量级是不一样的。对双非来说,最难的就是约面,怎么才能被大厂约面试?首先这需要一点运气,另外你也需要好的实习带给你的背书。有很多双非的同学在一些外包小厂待了四五个月,这样的产出有什么用呢?工厂的可视化大屏业务很广泛?产出无疑是重要的,但是得当你的实习公司到了一定的档次之后,比如你想走后端,那么中厂后端和大厂测开的选择,你可以选择中厂后端(注意,这里的中厂也得是一些人都知道的,比如哈啰,得物,b站之类,不是说人数超过500就叫中厂),只有这个时候你再去好好关注你的产出,要不就无脑大厂就完了。很多双非同学的误区就在这里,找到一份实习之后,就认为自己达到了阶段性的任务,根本不再投递简历,也不再提升自己,玩了几个月之后,美其名曰沉淀产出,真正的好产出能有多少呢?而实际上双非同学的第一份实习大部分都是工厂外包和政府外包!根本无产出可写😡😡😡!到了最后才发现晚了,所以对双非同学来说,不要放过任何一个从小到中,从中到大的机会,你得先有好的平台与title之后再考虑你的产出!因为那样你才将将能过了HR初筛!我认识一个双非同学,从浪潮到海康,每一段都呆不久,因为他在不断的投递和提升自己,最后去了美团,这才是双非应该做的,而我相信大部分的双非同学,在找到浪潮的那一刻就再也不会看八股,写算法,也不会打开ssob了,这才是你跟别人的差距。
迷茫的大四🐶:我也这样认为,title永远第一,只有名气大,才有人愿意了解你的简历
双非本科求职如何逆袭
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务