【HDU 5858】Hard problem】的更多相关文章

边长是L的正方形,然后两个半径为L的圆弧和中间半径为L的圆相交.求阴影部分面积. 以中间圆心为原点,对角线为xy轴建立直角坐标系. 然后可以联立方程解出交点. 交点是$(\frac{\sqrt{7} L}{4\sqrt{2}},\frac{L}{4\sqrt{2}})$. 然后用余弦定理求角度.就可以求扇形面积. 阴影部分的一块=半圆-扇形*2-(大扇形-三角形)*2. 具体可以自己画图画一下. #include <cstdio> #include <cmath> #define…
边长是L的正方形,然后两个半径为L的圆弧和中间直径为L的圆相交.求阴影部分面积. 以中间圆心为原点,对角线为xy轴建立直角坐标系. 然后可以联立方程解出交点. 交点是$(\frac{\sqrt{7} L}{4\sqrt{2}},\frac{L}{4\sqrt{2}})$. 然后用余弦定理求角度.就可以求扇形面积. 下图灰色部分面积=半圆-扇形S*2-(大扇形B-三角形T)*2. S=(绿色+橙色)的一半,B=(绿色+粉色+浅黄色)的一半,T=(粉色+绿色)的一半 #include <cstdio…
题意 f(x)=|ax3+bx2+cx+d| 求f(x)在L≤x≤R的最大值. 分析 参数有可能是0,注意分类讨论 1.当a=0时 b=0,f为一次函数(c≠0)或者常数函数(c=0),最大值点在区间端点. b≠0,f为二次函数,最大值点在区间端点或者x0=c/(2*b),当L≤x0≤R时,ans=max{f(L),f(R),f(x0)}. 2.当a≠0时,f为三次函数 最大值点在区间端点或者导函数的零点x1,x2. 注意x1,x2是否在[L,R]区间. 代码 #include<cstdio>…
pid=5647">[HDU 5647]DZY Loves Connecting(树DP) DZY Loves Connecting Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 332    Accepted Submission(s): 112 Problem Description DZY has an unroote…
pid=5145">[HDU 5145] NPY and girls(组合+莫队) NPY and girls Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 593    Accepted Submission(s): 179 Problem Description NPY's girlfriend blew him out!H…
[HDU  3555]原题直通车: 代码: // 31MS 900K 909 B G++ #include<iostream> #include<cstdio> #include<cstring> using namespace std; int a[20]; __int64 dp[20][11]; void digit_dp() { memset(dp, 0LL, sizeof(dp)); dp[0][0]=1; for(int i=1; i<20; ++i)…
[把三道我做过的线性基题目放在一起总结一下,代码都挺简单,主要就是贪心思想和异或的高斯消元] [然后把网上的讲解归纳一下] 1.线性基: 若干数的线性基是一组数a1,a2,a3...an,其中ax的最高位的1在第x位. [就是原集合的任意子集的异或和 与 线性基的任意子集的异或和 完全相等] 2.线性基的构造法: 对每个数p从高位到低位扫,扫到第x位为1时,若ax不存在,则ax=p并结束此数的扫描,否则令p=p xor ax. [高斯消元] 异或版高斯消元后的线性基会变成类似上面的样子(线性基是…
[HDU 2196] Computer(树的直径) 题链http://acm.hdu.edu.cn/showproblem.php?pid=2196 这题可以用树形DP解决,自然也可以用最直观的方法解,先求出树的直径,那么树的任意节点的最远点必然是直径上的两个端点之一,证明可以通过反证法构造: 设端点为a,b;设任意点为i,假设存在一点c到i的距离大鱼i到a,b的距离,那么a与c又能形成一个距离更长的点对,与ab是直径的假设不符,因此不存在c,证明完成. #include <queue> #i…
[HDU 2196] Computer 题链http://acm.hdu.edu.cn/showproblem.php?pid=2196 刘汝佳<算法竞赛入门经典>P282页留下了这个问题:给出一棵树,求每个节点的最远点,每一个节点的最远点有两种可能,一种是向下拓展的最远点,一种是父节点的最远点,那么需要两次dfs即可.一次求出每个节点的最远点和次远点,一次直接计算. #include <queue> #include <cmath> #include <cstd…
Problem Description There are N hotels all over the world. Each hotel has a location and a price. M guests want to find a hotel with an acceptable price and a minimum distance from their locations. The distances are measured in Euclidean metric. Inpu…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1286 Accepted Submission(s): 585 Problem Description Alice and Bob are playing a game called "Climbing the Hill". The game board consists of ce…
Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1123 Accepted Submission(s): 595 Problem Description Let's play a card game called Gap. You have 28 cards labeled with two-digit numbers. The firs…
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 23543 Accepted Submission(s): 7173 Problem Description 现有一笔经费可以报销一定额度的发票.允许报销的发票类型包括买图书(A类).文具(B类).差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元.现…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 21981 Accepted Submission(s): 8121 Problem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys us…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8010 Accepted Submission(s): 2837 Problem Description Homer: Marge, I just figured out a way to discover some of the talents we weren't aware we had…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 208 Accepted Submission(s): 119 Problem Description dingyeye loves play stone game with you. dingyeye has an n-point tree.The nodes are numbered fro…
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 11084 Accepted Submission(s): 7454 Problem Description 十年前读大学的时候,中国每年都要从国外引进一些电影大片,其中有一部电影就叫<勇敢者的游戏>(英文名称:Zathura),一直到现在,我依然对于电影中的部分电脑特技印象深刻. 今天,大家…
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2403 Accepted Submission(s): 1441 Problem Description 有两堆石子,数量任意,可以不同.游戏开始由两个人轮流取石子.游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子:二是可以在两堆中同时取走相同数量的石子.最后把石子全部取…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 592 Accepted Submission(s): 341 Problem Description After he has learned how to play Nim game, Mike begins to try another stone game which seems muc…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6706 Accepted Submission(s): 3646 Problem Description 有两堆石子,数量任意,可以不同.游戏开始由两个人轮流取石子.游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子:二是可以在两堆中同时取走相同数量的石子.最后把石子全部取…
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3030 Accepted Submission(s): 1823 Problem Description m堆石子,两人轮流取.只能在1堆中取.取完者胜.先取者负输出No.先取者胜输出Yes,然后输出怎样取子.例如5堆 5,7,8,9,10先取者胜,先取者第1次取时可以从有8个的那一堆取走7个…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1851 Accepted Submission(s): 1065 Problem Description After hh has learned how to play Nim game, he begins to try another coin game which seems much…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65568/32768 K (Java/Others) Total Submission(s): 1716 Accepted Submission(s): 1243 Problem Description One day, Flyvan introduced a new game to his two friends, Oregon Maple and Grape Skin. The gam…
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 677 Accepted Submission(s): 321 Problem Description We know that Daizhenyang is chasing a girlfriend. As we all know, whenever you chase a beautiful…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 710 Accepted Submission(s): 501 Problem Description Bob and Alice are playing a new game. There are n boxes which have been numbered from 1 to n. Ea…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2016 Accepted Submission(s): 1048 Problem Description Nim is a two-player mathematic game of strategy in which players take turns removing objects f…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4232 Accepted Submission(s): 1959 Problem Description 当日遇到月,于是有了明.当我遇到了你,便成了侣. 那天,日月相会,我见到了你.而且,大地失去了光辉,你我是否成侣?这注定是个凄美的故事.(以上是废话) 小t和所有世俗的人们一样,期待那百年…
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7410 Accepted Submission(s): 3127 Problem Description Arthur and his sister Caroll have been playing a game called Nim for some time now. Nim is pla…
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5536 Accepted Submission(s): 3151 Problem Description Stan and Ollie play the game of multiplication by multiplying an integer p by one of the numbe…
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 487 Accepted Submission(s): 157 Problem Description Many people think that Tetris was invented by two Russian programmers. But that is not the whole…