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]个,问最多能用多少个硬币. 思路 首先确定,对于每个硬币就是能用小的替换就不用大的. 所以,可以先把硬币尽量用小的替换,如果小的不够 ...
随机推荐
- 人品计算器 JFrame 窗体软件版 JPanel JTextField JTextArea JButtton JLabel setContentPane Swing包(用户界面工具包)
import java.awt.BorderLayout; import java.awt.Color; import java.awt.GridLayout; import java.awt.eve ...
- BZOJ1576: [Usaco2009 Jan]安全路经Travel(最短路 并查集)
题意 给你一张无向图,保证从1号点到每个点的最短路唯一.对于每个点求出删掉号点到它的最短路上的最后一条边(就是这条路径上与他自己相连的那条边)后1号点到它的最短路的长度 Sol emmm,考场上想了个 ...
- jQuery的三种写法
jQuery的三种写法 jQuery一共有三种写法,写法如下: <script type="text/javascript" src="js/jquery-1.9. ...
- Tesseract-ocr视觉学习-验证码识别及python import pytesseract使用
Tesseract-OCR的简单使用与训练 最近看到某个网站提交数据要提交验证码,用tesseract自带的识别, 识别出来是什么鬼,0-9识别成了什么玩意! so决定自己训练下tesseract.. ...
- Laravel — homestead 配置多站点
一.homestead.yaml 配置 homestead.yaml 文件配置sites,如下 sites: - map: homestead.test to: /home/vagrant/Code/ ...
- 第39-43课 thinkphp5完成商品会员价格功能(后置勾子afterInsert)
目录 功能一:利用后置勾子,处理好商品主键id,会员的价格,再插入member_price表里. 要实现的功能: 思路: html里 控制器里 模型里的后置勾子afterInsert() 功能二:利用 ...
- ob缓存的基本使用
在页面 加载的时候 如果 图片 很多 很大 会造成页面的阻塞降低用户体验 我们在点击页面的时候可以使用OB缓存 整个页面, 当用户点击的时候直接请求的是我们预先准备好的html页面 .也降低了我们数据 ...
- 721. Accounts Merge
https://leetcode.com/problems/accounts-merge/description/ class UnionFound { public: unordered_map&l ...
- ubuntu版本查看
cat /proc/version uname -a lsb_release -a
- Labyrinth POJ - 1383
Labyrinth POJ - 1383 The northern part of the Pyramid contains a very large and complicated labyrint ...