Tea is good.

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的更多相关文章

  1. hdu 5881 Tea (2016 acm 青岛网络赛)

    原题地址:http://acm.hdu.edu.cn/showproblem.php?pid=5881 Tea Time Limit: 3000/1000 MS (Java/Others)    Me ...

  2. HDU 5881 Tea

    Tea Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...

  3. HDU 5881 Tea -2016 ICPC 青岛赛区网络赛

    题目链接 题意:有一壶水, 体积在 L和 R之间, 有两个杯子, 你要把水倒到两个杯子里面, 使得杯子水体积几乎相同(体积的差值小于等于1), 并且使得壶里剩下水体积不大于1. 你无法测量壶里剩下水的 ...

  4. HDU 5881 Tea (模拟)

    题意:有一壶水, 体积在 LLL 和 RRR 之间, 有两个杯子, 你要把水倒到两个杯子里面, 使得杯子水体积几乎相同(体积的差值小于等于1), 并且使得壶里剩下水体积不大于1. 你无法测量壶里剩下水 ...

  5. 【2016 ACM/ICPC Asia Regional Qingdao Online】

    [ HDU 5878 ] I Count Two Three 考虑极端,1e9就是2的30次方,3的17次方,5的12次方,7的10次方. 而且,不超过1e9的乘积不过5000多个,于是预处理出来,然 ...

  6. hdu Hat's Tea

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1288 去买茶,需要正好的钱才行,另外花的钱的个数最多  其实是一个简单的贪心问题,小的多取一点,多的少 ...

  7. HDU 6667 Roundgod and Milk Tea (思维)

    2019 杭电多校 8 1011 题目链接:HDU 6667 比赛链接:2019 Multi-University Training Contest 8 Problem Description Rou ...

  8. HDU 6667 Roundgod and Milk Tea

    hdu题面 Time limit 6000 ms Memory limit 131072 kB OS Windows Source 2019 Multi-University Training Con ...

  9. hdu 1288 Hat's Tea

    这个要慢慢理解…… ;}

随机推荐

  1. manacher 模板

    求最长回文子序列的 O(n)做法 讲解 #include <iostream> #include <cstdio> #include <algorithm> #in ...

  2. 自兴人工智能-------------Python入门基础(1)

    Python 是一门简单易学且功能强大的编程语言. 它拥有高效的高级数据结构, 并且能够用简单而又高效的方式进行面向对象编程. Python 优雅的语法和动态 类型,再结合它的解释性,使其在大多数平台 ...

  3. Visual Studio 2017 for Mac 连接Git的奇怪问题

    VS for Mac连接Git的时候遇到个奇怪的问题, 无法将已存在的解决方案绑定并提交到GitHub中去. VS版本7.3.3 问题复现 以为自己操作有问题, 新建项目测试一下, 新建的时候没有勾选 ...

  4. 【JavaWeb】权限管理系统

    前言 前面我们做的小项目都是一个表的,业务代码也相对简单.现在我们来做一个权限管理系统,体验一下多表的业务逻辑,顺便巩固一下过滤器的知识.! 目的 现在我有一个管理商品.订单的页面.当用户点击某个超链 ...

  5. Python标准异常总结

    Python标准异常总结 AssertionError 断言语句(assert)失败 AttributeError 尝试访问未知的对象属性  EOFError 用户输入文件末尾标志EOF(Ctrl+d ...

  6. 1.4 random模块

    Python中的random模块用于生成随机数,下面介绍一下random模块中最常用的几个函数. 国际惯例,用模块之前先导入: >>> import random (一)random ...

  7. flask中jinjia2模板引擎使用详解1

    在之前的文章中我们介绍过flask调用jinja2模板的基本使用,这次我们来说一下jinjia2模板的使用 Jinja2 在其是一个 Python 2.4 库之前,被设计 为是灵活.快速和安全的. 模 ...

  8. linux链接

    ( 1 )软连接可以跨文件系统,硬连接不可以 ( 2 )硬连接不管有多少个,都指向的是同一个 I 节点,会把结点连接数增加,只要结点的连接数不是 0 ,文件就一直存在不管你删除的是源文件还是连接的文件 ...

  9. 【视频教程】一步步将AppBox升级到Pro版

    本系列教程分为上中下三部分,通过视频的形式讲解如何将基于FineUI(开源版)的AppBox v6.0一步一步升级FineUIPro(基础版). [视频教程]一步步将AppBox升级到Pro版(上)主 ...

  10. 最短路径问题(dijkstra-模板)

    #include<bits/stdc++.h> using namespace std; ][]; ]; ]; ][]; int n,x,y,s,m,e; int k; double mi ...