HDU 2289 Cup】的更多相关文章

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 二分法解题. 这个题很恶心...一开始测试样例都不能过,这个π一开始取3.1415926结果是99.999026,改为3.1414927,结果是99.999023..我就发现这个π对结果影响很大,这个题对π的精度要求也比较高...然后我的π就改为3.1415926536... 一开始判断跳出二分的条件是结果差值小于0.000000001,发现超时,改为0.01后还是超时...无语了...然后仔细想想,题…
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…
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…
这道题目.运营商做数学题?算上两个子主题做?顶多算一个水主要议题... 首先,没有实际的二分法,但是,我们发现了一个新的解决方案,以取代二分法. 若果按照i从0,每次添加0.00000001我一直枚举h如果,绝对逼暂停.枚举太大 然而,它可以分为两个步骤: #include<cstdio> #include<cmath> #define pai acos(-1.0) double r1,r2,h,v; double get_v(double temp) { double rr=r1…
<题目链接> 题目大意: 一个圆台型的杯子,它的上底半径和下底半径已经给出,并且给出它的高度,问你,体积为V的水倒入这个杯子中,高度为多少. 解题分析: 就是简单的二分答案,二分枚举杯中水的高度,然后根据几何计算出该高度下,水的上半径,然后计算出该高度下水的体积,在与实际水的体积进行比较,从而确定最终的答案. #include <cstdio> #include <cstring> #include <cmath> const double PI=acos(…
题目传送门 /* 二分搜索:枚举高度,计算体积与给出的比较. */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using namespace std; ; const int INF = 0x3f3f3f3f; ; const double PI = acos (-1.0); double r, R, H, V; double x; double ca…
题目传送门:https://vjudge.net/problem/HDU-2289 题意:有一个上口小于底部的圆台形水杯,告诉我们水的体积求水高度. 思路:利用高中数学知识求rr然后二分求h,具体化简过程见下图. 1 //#include<bits/stdc++.h> 2 #include<time.h> 3 #include <set> 4 #include <map> 5 #include <stack> 6 #include <cma…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2289 大意是 一个Cup,圆台形,给你它的顶部圆的半径,底部圆的半径,杯子的高度,和此时里面装的水的体积,求水的高度. 这道题好在能够锻炼算法思维,或者说形成算法思维. 这是一道二分逼近求值的应用 题目已经给定杯子的高度是0~100,故在这个范围内进行二分,但走了涉及到还有小数的问题,故可以取一个精度较高的误差值 来作为二分的条件,二分一次,以这个值作为水的高度求出水的体积与实际值比较一次,当误差不…
Problem Description The WHU ACM Team has a big cup, with which every member drinks water. Now, we know the volume of the water in the cup, can you tell us it height? The radius of the cup's top and bottom circle is known, the cup's height is also kno…