HDU 2493 Timer 数学(二分+积分)】的更多相关文章

传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2493 题意:给你一个圆锥,水平放置,圆锥中心轴与地面平行,将圆锥装满水,在圆锥某一表面开一个小洞,流出来水的体积为V,给你地面直径D,高H,让你求小洞里地面的距离.(保证距离大于等于半径,小于等于直径) 题解:因为流出来水的那部分是一个不规则形状(相当于将圆锥水平切开,截面是一个三角形),我们可以二分答案下降高度r,现在关键是求体积. 然后通过一系列很复杂的积分运算,得出结果: 记得最后求出来的答案要…
题意:求图中交叉圆柱体的体积! 析:大体思路很明确,把两个圆柱的体积加起来 减去中间公共部分的即可!第一步首先得想到公共部分是一个怎样的图形.这个在高数下册例题中有讲到! 中间实线部分就是第一卦限内的图形,显然一个二重积分就可以搞定: 这种情况比较简单点,适合于2*R <= h 的时候! 如果2*R > h话! 需要加点想象力,中间公共部分 是一个长方体 加上两个小突起 也是把他分成8份,只算第一卦限内的. 把他放到坐标系里 与上一个图相比,没什么变换 只是将上一个图沿x轴平移了h/2 个单位…
DZY Loves Partition 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5646 Description DZY loves partitioning numbers. He wants to know whether it is possible to partition n into the sum of exactly k distinct positive integers. After some thinking he f…
题意: 给定一个素数p(p <= 1e12),问是否存在一对立方差等于p. 分析: 根据平方差公式: 因为p是一个素数, 所以只能拆分成 1*p, 所以 a-b = 1. 然后代入a = b + 1. 求出 3a² + 3a + 1 = p 化简得a(a+1) = (p-1)/3 令(p-1)/3 = T, 问题化为是否存在整数a使得a(a+1) == T, 那么令 t = (int)sqrt(T),只要判定一下t * (t+1) == T ? 即可 另一种做法是打一个a的表(a只要打到1e6)…
Problem - 4430 题意是,给出蜡烛的数量,要求求出r和k,r是蜡烛的层数,k是每一层蜡烛数目的底数. 开始的时候,没有看清题目,其实中间的那根蜡烛是可放可不放的.假设放置中间的那根蜡烛,就可以用等比数列求和公式S=(k^(r+1)-1)/(k-1),因为这个公式,对于固定的r,S(k)是单调递增的,然后可以发现,r的范围是相当的小的,最多不会大于40,然后就可以对于每一个r进行一次二分查找,找到k.但是,对于r==1的时候,用这个公式的是会爆龙龙的,而r==1的时候又是直接可以计算出…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3586 给定n个敌方据点,1为司令部,其他点各有一条边相连构成一棵树,每条边都有一个权值cost表示破坏这条边的费用,叶子节点为前线.现要切断前线和司令部的联系,每次切断边的费用不能超过上限limit,问切断所有前线与司令部联系所花费的总费用少于m时的最小limit.1<=n<=1000,1<=m<=10^6 dp[i]表示i节点为root的这个子树所破坏的最少费用,if(cost[i]…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5726 给你n个数,q个询问,每个询问问你有多少对l r的gcd(a[l] , ... , a[r]) 等于的gcd(a[l'] ,..., a[r']). 先用RMQ预处理gcd,dp[i][j] 表示从i开始2^j个数的gcd. 然后用map存取某个gcd所对应的l r的数量. 我们可以在询问前进行预处理,先枚举i,以i为左端点的gcd(a[i],..., a[r])的种类数不会超过log2(n)…
Pyramid Split Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=629&pid=1001 Description 小明是城会玩,他有很多底面是正方形的黄金锥体,我们称之为金字塔,它由高度和底面正方形边长可以确定,分别称之为金字塔的高和宽. 为了便于理解,单位统一取米.现在小明有nn个金字塔,已知它们的高和宽,小…
simpson公式是用于积分求解的比较简单的方法(有模板都简单…… 下面是simpson公式(很明显 这个公式的证明我并不会…… (盗图…… 因为一段函数基本不可能很规则 所以我们要用自适应积分的方法 找了一道很水的积分题试试模板…… 关于simpson要*15 网上有很具体的证明过程…… (细节移步至:http://www2.math.umd.edu/~mariakc/teaching/adaptive.pdf #include<cstdio> #include<iostream>…
XOR 游戏 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5715 Description 众所周知,度度熊喜欢XOR运算(XOR百科). 今天,它发明了一种XOR新游戏,最开始,它有一个长度为N的数组,度度熊可以任意添加分割线,将数组划分为M段,且每段长度小于等于L. 当然这是个和XOR有关的游戏,度度熊希望所有分组内异或和的最小值最大. 比如,长度为4的数组{1,2,3,4},L为3,可以划分为{1|2,3,4} 或 {1,2|3,4} 或…
货物运输 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5699 Description 公元2222年,l国发生了一场战争. 小Y负责领导工人运输物资. 其中有m种物资的运输方案,每种运输方案形如li,ri.表示存在一种货物从li运到ri. 这里有n个城市,第i个城市与第i+1个城市相连(这里1号城市和n号城市并不相连),并且从i号城市走到i+1号或者从i+1号走到i号需要耗费1点时间. 由于高科技的存在,小Y想到了一种节省时间的好方案.在X号…
Robot 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5673 Description There is a robot on the origin point of an axis.Every second, the robot can move right one unit length or do nothing.If the robot is on the right of origin point,it can also move…
Marriage Match II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4021    Accepted Submission(s): 1309 Problem Description Presumably, you all have known the question of stable marriage match. A…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1281 棋盘游戏 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2905    Accepted Submission(s): 1702 Problem Description 小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽…
Cyclic Tour Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/65535 K (Java/Others)Total Submission(s): 1197    Accepted Submission(s): 626 Problem Description There are N cities in our country, and M one-way roads connecting them. Now Li…
题目链接:hdu 4969 Just a Joke 题目大意:Guizeyanhua要去追一个女孩,女孩在以Guizeyanhua为圆心,半径为R的圆上匀速运动,女孩的速度为v1,Guizeyanhua的速度为v2,半径为R,Guizeyanhua腿疼仅仅能跑距离D.如今Guizeyanhua要去追女孩,前提条件是女孩,Guizeyanhua,圆心必须保持共线. 解题思路:由于有三点要共线的条件,所以Guizeyanhua和女孩的线速度必须同样,所以有v1R=vxr(vx为Guizeyanhua…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5587 题目大意就是初始有一个1,然后每次操作都是先在序列后面添加一个0,然后把原序列添加到0后面,然后从0到末尾,每一个都加上1. 例如:a0, a1, a2 => a0, a1, a2, 1, a0+1, a1+1, a2+1 题解中是这么说的:“ 其实Ai为i二进制中1的个数.每次变化A{k+2^i}=A{k}+1,(k<2^​i​​)不产生进位,二进制1的个数加1.然后数位dp统计前m个数二…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1724 函数都给出来了,可以用辛普森积分: 一开始 eps = 1e-8 TLE了,答案只要三位小数,那么 eps = 1e-5 即可: 这次用了比较标准的写法^_^ 代码如下: #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; typ…
Assignment Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 3813    Accepted Submission(s): 1771 Problem Description Tom owns a company and he is the boss. There are n staffs which are numbered…
Sort Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2377    Accepted Submission(s): 610 Problem Description Recently, Bob has just learnt a naive sorting algorithm: merge sort. Now, Bob receiv…
题目链接:HDU 1724 Problem Description Math is important!! Many students failed in 2+2's mathematical test, so let's AC this problem to mourn for our lost youth.. Look this sample picture: A ellipses in the plane and center in point O. the L,R lines will…
G - Queue HDU - 5493 题目大意:给你n个人的身高和这个人前面或者后面有多少个比他高的人,让你还原这个序列,按字典序输出. 题解: 首先按高度排序. 设每个人在其前面有k个人,设比这个人高有x个人,所以k=min(k,x-k),求出每一个人在他前面比他高的人的数量. 然后用线段树来维护一段区间的空位,因为对于每一个人来说比他高的人肯定都是出现在他后面,所以这个就说明它前面要空出几个空位. 但是线段树可以维护一段区间的空位,没办法准确找出我需要空位为一个准确的数的位置. 这个就可…
Bomb Game Time Limit: 10000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2951    Accepted Submission(s): 984 Problem Description Robbie is playing an interesting computer game. The game field is an unbounded…
题目链接: 传送门 Flyer Time Limit: 1000MS     Memory Limit: 32768 K Description The new semester begins! Different kinds of student societies are all trying to advertise themselves, by giving flyers to the students for introducing the society. However, due…
Function Problem Description   The shorter, the simpler. With this problem, you should be convinced of this truth.    You are given an array A of N postive integers, and M queries in the form (l,r). A function F(l,r) (1≤l≤r≤N) is defined as:F(l,r)={A…
题意:有一个游戏,有n个回合,每回合可以在指定的2个区域之一放炸弹,炸弹范围是一个圈,要求每回合的炸弹范围没有重合.得分是炸弹半径最小的值.求可以得到的最大分数. 思路:二分+2SAT. 二分炸弹范围,再根据有无重合建图,用2SAT判定. #include <cstdio> #include <cmath> #include <vector> #include <cstring> using namespace std; ; struct TwoSAT {…
Triangle 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5914 Description Mr. Frog has n sticks, whose lengths are 1,2, 3⋯n respectively. Wallice is a bad man, so he does not want Mr. Frog to form a triangle with three of the sticks here. He decides…
一个人站在(0,0)处射箭,箭的速度为v,问是否能够射到(x,y)处,并求最小角度. 首先需要判断在满足X=x的情况下最大高度hmax是否能够达到y,根据物理公式可得 h=vy*t-0.5*g*t*t vx=v*cos(a) vy=v*sin(a) t=x/vx 由此可推出:h=x*tan(a)-(g*x*x)/(2*v*v)/cos(a)/cos(a) g,x,v已知,设A=x,B=(g*x*x)/(2*v*v) 原式化为:h=A*tan(a)+(-B/(cos(a)^2)) 由于凸函数有以下…
Problem Description During a programming contest, teams cannot sit close to each other, because then a team might copy the solution of another team. You are given the locations of the teams and the minimum required Euclidian distance between two team…
Radar Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2882    Accepted Submission(s): 1113 Problem Description N cities of the Java Kingdom need to be covered by radars for being in a state of w…