hdu Rich Game 6245
Rich Game
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 72 Accepted Submission(s):
34
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 X
dollars. For each time I lose one point, you should give me Y
dollars back.”
God Sheep is going to play K
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?
cases, T
. T
test cases follow.
Each test case contains 3 numbers in one line, X
, Y
, K
, 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≤X,Y,K≤1000.
#x: y”, where x
is the test case number (starting from 1) and y
is the maximal number of sets Mr. Panda could win.
10 10 1
10 10 2
Case #2: 1
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.
#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<string>
#include<queue>
#include<cmath>
using namespace std;
#define INF 0x3f3f3f3f
typedef vector<double> vec;
typedef vector<vec> mat;
const int N_MAX = ;
int in,out,num;
int T; int main() {
scanf("%d", &T);
int k = ;
while (T--) {
k++;
scanf("%d%d%d",&in,&out,&num);
if (out < in) {
printf("Case #%d: %d\n",k,num);
}
else{
int res = ,remain=;
while (num--) {
int pay = (out * - in * );
if (remain <pay ) {//付不起钱,这句要输
remain += in * ;
}
else {
remain-= pay;
res++;
}
}
printf("Case #%d: %d\n", k, res);
}
}
return ;
}
hdu Rich Game 6245的更多相关文章
- 2015ACM/ICPC亚洲区长春站 A hdu 5527 Too Rich
Too Rich Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total ...
- HDU 5527---Too Rich(贪心+搜索)
题目链接 Problem Description You are a rich person, and you think your wallet is too heavy and full now. ...
- HDU 2391 Filthy Rich (dp)
题目连接 Problem Description They say that in Phrygia, the streets are paved with gold. You're currently ...
- Too Rich HDU - 5527 (贪心+dfs)
Too Rich Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total ...
- HDU 5527 Too Rich
Too Rich Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total ...
- hdu 2391 Filthy Rich
单纯dp 水一 处理时间点,第一行和第一列特殊处理: 其余的w[i][j]=show(w[i-1][j-1],w[i-1][j],w[i][j-1]); <span style="fo ...
- 【算法系列学习】HDU 5527 Too Rich贪心
http://www.cnblogs.com/AOQNRMGYXLMV/p/4934747.html #include<iostream> #include<cstdio> # ...
- HDU 5527 Too Rich 贪心
题意: 有\(10\)种面值为\(1, 5, 10, 20, 50, 100, 200, 500, 1000, 2000\)的纸币,现在你要选最多的数量凑成\(p\)块钱. 分析: 同样分析问题的反面 ...
- HDU 5527:Too Rich(DFS+贪心)***
题目链接 题意 给出p块钱,现在要用十种硬币凑出,每种硬币有c[i]个,问最多能用多少个硬币. 思路 首先确定,对于每个硬币就是能用小的替换就不用大的. 所以,可以先把硬币尽量用小的替换,如果小的不够 ...
随机推荐
- es6中的类及es5类的实现
目录 类的特点 类的特点 1.类只能通过new得到 在es6中类的使用只能是通过new,如果你将它作为一个函数执行,将会报错. //es6的写法 class Child { constructor() ...
- 洛谷 P1346 电车
这道题的关键在建图 把每一个车站看成一个点,将这个车站相连的第一个车站建立一条边权为0的边,对于它所相连的其他车站,建立边权为1的边: 这样我们可以得到一张图: 起点,终点都知道了,跑一边最短路即可 ...
- ZJOI2019Round#1
考的这么差二试基本不用去了 不想说什么了.就把这几天听课乱记的东西丢上来吧 这里是二试乱听课笔记ZJOI2019Round#2 ZJOI Round#1 Day1 M.<具体数学>选讲 罗 ...
- 快速搭建lvs + keepalived + nginx
环境: VIP 192.168.2.224 LVS 192.168.2.217 centos7 nginx1 192.168.2.231 c ...
- 5.Cisco Packet Tracer里关于交换机或路由器配置文件和系统映像备份与恢复
我们会将交换机或路由器的配置文件和系统镜像直接备份到tftp服务器上,所以我们需要准备一台tftp的服务器 1我们需要给服务器配一个ip地址,给路由器的f0/1端口配置一个ip地址,路由器与服务器能相 ...
- (新手)使用pandas操作EXCEL
import pandas as pdimport numpy as npfrom pandas import DataFrame,Series#path = r'C:\Users\tsl\Deskt ...
- 字符编码笔记:ASCII、Unicode和UTF-8
1. ASCII码 我们知道,在计算机内部,所有的信息最终都表示为一个二进制的字符串.每一个二进制位(bit)有0和1两种状态,因此八个二进制位就可以组合出256种状态,这被称为一个字节(byte). ...
- 动态规划:HDU-1398-Square Coins(母函数模板)
解题心得: 1.其实此题有两种做法,动态规划,母函数.个人更喜欢使用动态规划来做,也可以直接套母函数的模板 Square Coins Time Limit: 2000/1000 MS (Java/Ot ...
- Win7系统桌面便签怎么添加?
参考:http://jingyan.baidu.com/article/ab69b270c207432ca7189f99.html Win7系统桌面便签怎么添加?有时候工作.学习忙起来就会忘记要办的事 ...
- python2.X中文乱码
在IDE下,加上# -- coding: UTF-8 -- 并且保证IDE也是utf-8编码. 在CMD下,这样执行会有乱码,为啥呢,因为cmd下是gbk编码的,你写的代码必须也是gbk编码的,你可以 ...