Tea HDU - 5881
Tea is life.
Tea is everything.
The balance of tea is a journey of pursuing balance of the universe.
Alice knows that.
Alice wants to teach you the art of pouring tea.
Alice has a pot of tea.
The exact volume of tea is not important.
The exact volume of tea is at least LL.
The exact volume of tea is at most RR.
Alice put two empty cups between you and her.
Alice wants the two cups filled by almost equal volume of tea.
Yours cannot be 11 unit more than hers.
Hers cannot be 11 unit more than yours.
Alice wants you to pour the tea.
Alice wants you to pour until the pot is almost empty.
Alice wants no more than 11 unit volume of tea remaining in the pot.
You cannot read the residue volume of tea remaining in the pot.
You can only know the tea status in the pot, empty or not.
Alice does not want you to pour the tea too many times.
You better pour as few times as possible.
InputThere are multiple cases. 
For each case, there is one line of two integers LL and RR, separated by single space.
Here are some analyses about sample cases. 
For the first case, pouring 11 unit into one cup will satisfy Alice. 
For the second case, it is clearly that you cannot only pour once to reach the desired balance, but she can achieve it by pouring twice. 
First you pour 1.51.5 units into one cup, then you attempt to pour another 1.51.5 units into the other cup. 
Since the lower bound is 22, at least 0.50.5 unit remains in the pot after the first pouring. 
If the initial volume is in range [2,3][2,3], the second cup will have volume in range [0.5,1.5][0.5,1.5] which is balanced with 1.51.5 unit in the first cup, and at most 11 unit remain after these two attempts.
About 10001000 test cases, and 0≤L≤R≤10160≤L≤R≤1016.OutputFor each case, there should be a single integer in a single line, the least number of pouring attempts.Sample Input
2 2
2 4
Sample Output
1
2 题目非常的长 实际有用的不多
题意:
一个茶壶 两个杯子 茶壶里面的茶的容积在[L,R]之间,
将茶壶里面的茶倒入杯子里面,(要求两个杯子里面的茶体积不能差 1升以上,
而且最后茶壶里面的茶也不能多余1升)
求出最少要倒多少次? 这题是题意非常难以理解,不知道茶壶里面的体积具体为多少,在[L,R]之间,
所以说一次倒2L是最快的,先要使一个杯子里面的茶比另外一个杯子里面的茶多1L
然后一次倒2L
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std; int main() {
long long L,R;
while(scanf("%lld%lld",&L,&R)!=EOF){
long long sum;
if (R<=) sum=;
else if (R<=) sum=;
else {
if (L==) sum=(R+)/;
else {
sum=(R-L)/+;
if (sum<) sum=;
}
}
printf("%lld\n",sum);
}
return ;
}
Tea HDU - 5881的更多相关文章
- hdu 5881 Tea (2016 acm 青岛网络赛)
		
原题地址:http://acm.hdu.edu.cn/showproblem.php?pid=5881 Tea Time Limit: 3000/1000 MS (Java/Others) Me ...
 - HDU 5881 Tea
		
Tea Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...
 - HDU 5881 Tea -2016 ICPC 青岛赛区网络赛
		
题目链接 题意:有一壶水, 体积在 L和 R之间, 有两个杯子, 你要把水倒到两个杯子里面, 使得杯子水体积几乎相同(体积的差值小于等于1), 并且使得壶里剩下水体积不大于1. 你无法测量壶里剩下水的 ...
 - HDU 5881 Tea (模拟)
		
题意:有一壶水, 体积在 LLL 和 RRR 之间, 有两个杯子, 你要把水倒到两个杯子里面, 使得杯子水体积几乎相同(体积的差值小于等于1), 并且使得壶里剩下水体积不大于1. 你无法测量壶里剩下水 ...
 - 【2016 ACM/ICPC Asia Regional Qingdao Online】
		
[ HDU 5878 ] I Count Two Three 考虑极端,1e9就是2的30次方,3的17次方,5的12次方,7的10次方. 而且,不超过1e9的乘积不过5000多个,于是预处理出来,然 ...
 - hdu    Hat's Tea
		
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1288 去买茶,需要正好的钱才行,另外花的钱的个数最多 其实是一个简单的贪心问题,小的多取一点,多的少 ...
 - HDU 6667 Roundgod and Milk Tea (思维)
		
2019 杭电多校 8 1011 题目链接:HDU 6667 比赛链接:2019 Multi-University Training Contest 8 Problem Description Rou ...
 - HDU 6667 Roundgod and Milk Tea
		
hdu题面 Time limit 6000 ms Memory limit 131072 kB OS Windows Source 2019 Multi-University Training Con ...
 - hdu 1288 Hat's Tea
		
这个要慢慢理解…… ;}
 
随机推荐
- css模板
			
最近好多人问我博客的css模板.... 现在是高三,没多少时间,趁放假赶紧更一下 主体就是把博客园的一个模板改动了一点 上面的图片特效,也是从别人那里得到的代码,大致就是下面那些,下面的三个图片换成自 ...
 - 夏令营讲课内容整理 Day 5.
			
DP专场.. 动态规划是运筹学的一个分支, 求解决策过程最优化的数学方法. 我们一般把动态规划简称为DP(Dynamic Programming) 1.动态规划的背包问题 有一个容量为m的背包,有 ...
 - BZOJ 4766: 文艺计算姬 [矩阵树定理 快速乘]
			
传送门 题意: 给定一个一边点数为n,另一边点数为m,共有n*m条边的带标号完全二分图$K_{n,m}$ 求生成树个数 1 <= n,m,p <= 10^18 显然不能暴力上矩阵树定理 看 ...
 - Linux设置DNS地址及清理DNS缓存方法
			
1.设置DNS地址 编辑vim /etc/resolv.conf 文件. 增加DNS地址:nameserver ip. 2.清理DNS缓存 清理dns缓存: 通过重启nscd服务来达到清理dns缓存的 ...
 - [实例]JAVA生成字母+随机数字并生成文件
			
package com.ishow.control.code; import java.io.*; import java.text.SimpleDateFormat; import java.uti ...
 - python  路飞模块一考核总结
			
1. 分别解释"=","==","+="的含义(口述) =为赋值语句,把一个变量值赋予另一个值 == 为条件判断,判断两个值是否相等 += ...
 - win7局域网共享文件
			
调整共享文件所在电脑设置: 1. 关闭防火墙 2. 更改网络设置 ①打开网络和共享中心 ②进入"选择家庭组和共享选项" ③进入"更改高级共享设置" ④调整设置并 ...
 - windows服务器修改登录密码
			
1. 右键我的电脑---管理 2. 计算机管理---本地用户和组--用户 3. 右键administrator用户,选择修改密码 4. 点击继续进入下一步 5. 输入新密码并保存
 - eclipse中创建一个maven项目
			
1.什么是Maven Apache Maven 是一个项目管理和整合工具.基于工程对象模型(POM)的概念,通过一个中央信息管理模块,Maven 能够管理项目的构建.报告和文档. Maven工程结构和 ...
 - CentOS 6安装Oracle报错解决方案
			
1. Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-05-23_04-18-48AM. Please ...