HDU2289-Cup-二分】的更多相关文章

贴代码: 题目意思:已知r水的下半径,R水的上半径,H为圆台高度,V为水的体积,求水的高度,如图: 水的高度一定在0-100,所以在这个区间逐步二分,对每次二分出的水的高度,计算相应的体积,看看计算出的这个体积和已知的水体积之差是否小于1e-9,如果小于,就说明计算出的体积已经无限接近真正的水体积,那么这次二分出的水高度即为所求高度,如果大于1e-9,就再次二分,直到二分出正确的高度为止.…
Cup Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6684    Accepted Submission(s): 2062 Problem Description The WHU ACM Team has a big cup, with which every member drinks water. Now, we know th…
HDU 1000 A + B Problem  I/O HDU 1001 Sum Problem  数学 HDU 1002 A + B Problem II  高精度加法 HDU 1003 Maxsum  贪心 HDU 1004 Let the Balloon Rise  字典树,map HDU 1005 Number Sequence  求数列循环节 HDU 1007 Quoit Design  最近点对 HDU 1008 Elevator  模拟 HDU 1010 Tempter of th…
A. Is it rated? time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Is it rated? Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to a…
Cup Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8942    Accepted Submission(s): 2744 Problem Description The WHU ACM Team has a big cup, with which every member drinks water. Now, we know th…
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=2289 hdu_2289:Cup Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5747    Accepted Submission(s): 1807 Problem Description The WHU ACM Team has a b…
A. Is it rated? time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Is it rated? Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to a…
<题目链接> 题目大意: 一个圆台型的杯子,它的上底半径和下底半径已经给出,并且给出它的高度,问你,体积为V的水倒入这个杯子中,高度为多少. 解题分析: 就是简单的二分答案,二分枚举杯中水的高度,然后根据几何计算出该高度下,水的上半径,然后计算出该高度下水的体积,在与实际水的体积进行比较,从而确定最终的答案. #include <cstdio> #include <cstring> #include <cmath> const double PI=acos(…
There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken by somebo…
题意:有两个服务要求被满足,服务S1要求x1数量的资源,S2要求x2数量的资源.有n个服务器来提供资源,第i台能提供a[i]的资源.当你选择一定数量的服务器来为某个服务提供资源后,资源需求会等量地分担给它们,要求每台服务器承担的资源需求不超过其所能提供的资源需求.给定一种合法的方案,每台服务器要么没有被分配给任何一个服务,或者被分配给其中一个服务. 对服务器按能提供的资源从小到大排序.枚举给S1分配的服务器数量i,然后在a数组中二分,就可以得到给S1提供的是哪i台服务器,它们占据了a数组中连续的…
A. Vicious Keyboard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Tonio has a keyboard with only two letters, "V" and "K". One day, he has typed out a string s with only t…
A. Petr and a calendar time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to wee…
J. Rising Sun time limit per test 1.0 s memory limit per test 1024 MB input standard input output standard output Joon has a midterm exam tomorrow, but he hasn't studied anything. So he decided to stay up all night to study. He promised himself that…
平面上给你n(不超过2000)个点,问你能构成多少个面积在[A,B]之间的Rt三角形. 枚举每个点作为直角顶点,对其他点极角排序,同方向的按长度排序,然后依次枚举每个向量,与其对应的另一条直角边是单调的,可以用一个pointer做出来,然后可以得出那些同方向的向量的区间(这个代码好像有点问题,可能会退化,最好确定了一个LL之后,对一个方向的不要重复算RR.这里如果也改成二分就比较好,复杂度不会退化).然后通过二分可以得到A使得面积在[A,B]间的有哪些(其实这个因为也是单调的,好像也没必要二分,…
给你n个字符串,问你最小的长度的前缀,使得每个字符串任意循环滑动之后,这些前缀都两两不同. 二分答案mid之后,将每个字符串长度为mid的循环子串都哈希出来,相当于对每个字符串,找一个与其他字符串所选定的子串不同的子串,是个二分图最大匹配的模型,可以匈牙利或者Dinic跑最大流看是否满流. 一个小优化是对于某个字符串,如果其所有不同的子串数量超过n,那么一定满足,可以直接删去. 卡常数,不能用set,map啥的,采取了用数组记录哈希值,排序后二分的手段进行去重和离散化. #include<cst…
Preorder Test 题目连接: http://www.codeforces.com/contest/627/problem/D Description For his computer science class, Jacob builds a model tree with sticks and balls containing n nodes in the shape of a tree. Jacob has spent ai minutes building the i-th ba…
E. Simple Skewness 题目连接: http://www.codeforces.com/contest/626/problem/E Description Define the simple skewness of a collection of numbers to be the collection's mean minus its median. You are given a list of n (not necessarily distinct) integers. Fi…
C. Block Towers 题目连接: http://www.codeforces.com/contest/626/problem/C Description Students in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. n of the students use pieces…
E. Prairie Partition It can be shown that any positive integer x can be uniquely represented as x = 1 + 2 + 4 + ... + 2k - 1 + r, where k and r are integers, k ≥ 0, 0 < r ≤ 2k. Let's call that representation prairie partition of x. For example, the p…
https://codeforces.com/contest/1146/problem/C 题意 一颗大小为n的树,每次可以询问两个集合,返回两个集合中的点的最大距离,9次询问之内得出树的直径 题解 求树的直径:先找到一个点a,找到离他最远的一个点b,最后找到距离b最远的点c,b和c之间的距离就是树的直径 先询问离1最远的距离,然后二分找到这个点a,然后询问a的最远距离 代码 #include<bits/stdc++.h> #define fk fflush(stdout) using nam…
A. Robot Sequence time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Calvin the robot lies in an infinite rectangular grid. Calvin's source code contains a list of n commands, each either 'U'…
精度小一点就能过 #include<bits/stdc++.h> #define maxn 1000000009 #define esp 1e-9 #define PI 3.1415926535897932384626 using namespace std; double r,R,H,V,V1,h1,R1; double func(double h1){ R1=r+(h1/H)*(R-r); V1=((/)*PI*h1*(R1*R1+r*r+R1*r); return V1; } int m…
D. Office Keys time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as wel…
#include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <cmath> #include <iostream> using namespace std; bool fun(double l1,double r1,double l2,double r2){ return (l1 <= r2 && l1…
Inviting Friends Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 241 Accepted Submission(s): 97 Problem Description You want to hold a birthday party, inviting as many friends as possible, but you…
Cup Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7077    Accepted Submission(s): 2177 Problem Description The WHU ACM Team has a big cup, with which every member drinks water. Now, we know th…
题目链接 Problem Description You have got a cylindrical cup. Its bottom diameter is 2 units and its height is 2 units as well.The height of liquid level in the cup is d (0 ≤ d ≤ 2). When you incline the cup to the maximal angle such that the liquid insid…

Cup

Cup Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 932 Accepted Submission(s): 319   Problem Description The WHU ACM Team has a big cup, with which every member drinks water. Now, we know the vol…
An Easy Problem for Elfness Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 1235    Accepted Submission(s): 257 Problem Description Pfctgeorge is totally a tall rich and handsome guy. He plans t…
Forethought Future Cup - Elimination Round 窝也不知道这是个啥比赛QwQ A. Love "A" 给你一个串,你可以删去若干个元素,使得最后a的个数严格大于一半.求最大串长. #include<iostream> #include<cstdio> #include<cstring> using namespace std; char s[55];int v=0,n; int main() { scanf(&q…