题意:源点处有个圆,然后给你m个圆(保证互不相交.内含),如果源点圆和这些原相交了,就剪掉相交的部分,问你最后周长(最外面那部分的长度). 思路:分类讨论,只有内切和相交会变化周长,然后乱搞就行了.题目好像不用讨论给的圆包含源点圆的情况(0?),那么只剩内含(不变).相切(增加小圆周长).相离(不变).相交(余弦定理求一下).余弦定理都快忘了,本来打算构建rt三角形233.学到一招pi = acos(-1.0). 代码: #include<cstdio> #include<set>…
6354.Everything Has Changed 就是计算圆弧的周长,总周长=大圆周长+相交(相切)部分的小圆的弧长-覆盖掉的大圆的弧长. 相交部分小圆的弧长直接求出来对应的角就可以,余弦公式,然后反余弦得到角,由弧长公式=βr就可以了,大圆的就求大圆弧长对应的角就可以了. cosα=(/Oo/^2+r^2-R^2)/2*/Oo/*r /Oo/为两圆心角的距离. 贴一下队友博客,懒得写了... 6354计算几何 就这样,溜了.…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5294   题意:给你n个墓室,m条路径,一个人在1号墓室(起点),另一个人在n号墓室(终点),起点的那个人只有通过最短路径才能追上终点的那个人,而终点的那个人能切断任意路径. 第一问——终点那人要使起点那人不能追上的情况下可以切的最少的路径数,输出最少的路径数 第二问——起点那人能追上终点那人的情况下,终点那人能切断的最多的路径数,输出最多的路径数 思路:要使起点那人无法追上,只要使他的最短路径不存…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5319 Painter Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 826    Accepted Submission(s): 383 Problem Description Mr. Hdu is an painter, as we al…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5326 Work Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 583    Accepted Submission(s): 392 Problem Description It’s an interesting experience to…
Front compression Time Limit: 5000/5000 MS (Java/Others)    Memory Limit: 102400/102400 K (Java/Others)Total Submission(s): 158    Accepted Submission(s): 63 Problem Description Front compression is a type of delta encoding compression algorithm wher…
Terrorist’s destroy Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 24    Accepted Submission(s): 6 Problem Description There is a city which is built like a tree.A terrorist wants to destroy th…
Backup Plan Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 93    Accepted Submission(s): 36Special Judge Problem Description Makomuno has N servers and M databases. All databases are synchroniz…
Building Fence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 171    Accepted Submission(s): 25Special Judge Problem Description Long long ago, there is a famous farmer named John. He owns a bi…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=5361 题意:最短路.求源点到全部点的最短距离.但与普通最短路不同的是,给出的边是某点到区间[l,r]内随意点的距离. 输入一个n,代表n个点,输入n个l[i],输入n个r[i],输入n个c[i]. 对于i,表示i到区间[i - r[i]],i - l[i]]和区间[i + l[i],i + r[i]]内的随意点的距离为c[i]. 求1到各个点的最短距离. 思路:若建边跑最短路的话,由于边过多,所以不可行…
Integer Partition Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 22    Accepted Submission(s): 15 Problem Description Given n, k, calculate the number of different (unordered) partitions of n s…
题目链接:pid=5402">http://acm.hdu.edu.cn/showproblem.php?pid=5402 题意:给出一个n×m的矩阵,位置(i.j)有一个非负权值. 每一个点仅仅能经过一次.求从(1.1)到(n.m)权值总和最大的和.还需输出路径. 思路:由于走的点越多越好,所以得到规律,当n,m随意一个为奇数时.均能够走全然部点. 当n,m全为偶数时,当点(i.j)的i和j不同奇偶时,则除了(i,j)这个点均能够走完剩下的全部点. 剩下模拟就可以. n,m当中一个为奇数…
题目链接:pid=4950http://acm.hdu.edu.cn/showproblem.php?pid=4950">http://acm.hdu.edu.cn/showproblem.php?pid=4950 Monster Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 220    Accepted Submission…
题目链接:pid=5317" target="_blank">http://acm.hdu.edu.cn/showproblem.php?pid=5317 Problem Description Mr. Hdu is interested in Greatest Common Divisor (GCD). He wants to find more and more interesting things about GCD. Today He comes up with…
hdu2020多校-1 J Math is Simple 给定 \(n\) ,求 \[\sum\limits_{1\le a<b\le n \\ gcd(a,b)=1 \\ a+b\ge n} \frac{1}{ab} \] 的值,答案对 \(998244353\) 取模. Solution 令 \(f_n = \sum\limits_{1\le a<b\le n \\ gcd(a,b)=1 \\ a+b\ge n} \frac{1}{ab}\), \(g_n = \sum\limits_{1…
Palindrome Sub-Array Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 173    Accepted Submission(s): 80 Problem Description A palindrome sequence is a sequence which is as same as its reversed or…
Warm up Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 90    Accepted Submission(s): 12 Problem Description N planets are connected by M bidirectional channels that allow instant transportatio…
Vases and Flowers Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 38    Accepted Submission(s): 10 Problem Description Alice is so popular that she can receive many flowers everyday. She has N v…
这题官方结题报告一直在强调不难,只要注意剪枝就行. 这题剪枝就是生命....没有最优化剪枝就跪了:如果当前连续切割数加上剩余的所有切割数没有现存的最优解多的话,不需要继续搜索了 #include <cstdio> #include <iostream> #include <cmath> #include <cstring> #include <algorithm> # define MAX 33 using namespace std; stru…
题意摘自:http://blog.csdn.net/kdqzzxxcc/article/details/9474169 ORZZ 题意:给你N个花瓶,编号是0 到 N - 1 ,初始状态花瓶是空的,每个花瓶最多插一朵花. 然后有2个操作. 操作1,a b c ,往在a位置后面(包括a)插b朵花,输出插入的首位置和末位置. 操作2,a b ,输出区间[a , b ]范围内的花的数量,然后全部清空. 很显然这是一道线段树.区间更新,区间求和,这些基本的操作线段树都可以logN的时间范围内完成. 操作…
Nice boat Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 146    Accepted Submission(s): 75 Problem Description There is an old country and the king fell in love with a devil. The devil alw…
HDOJ--4869--Turn the pokers[组合数学+快速幂] 题意:有m张扑克,开始时全部正面朝下,你可以翻n次牌,每次可以翻xi张,翻拍规则就是正面朝下变背面朝下,反之亦然,问经过n次翻牌后牌的朝向有多少种情况.我们可以把正面朝上理解为1,反面朝上理解为0,那么可以理解为求01串的不同的组合方式有几种. 解题思路:我们可以知道,每张牌假设起始状态都为0,如果翻奇数次,该牌最后的情况是1,如果翻偶数次,该牌的最后情况为0.根据n次翻牌的个数找出1的个数的下限和上限,然后再在这个范围…
题意:已知昨天天气与今天天气状况的概率关系(wePro),和今天天气状态和叶子湿度的概率关系(lePro)第一天为sunny 概率为 0.63,cloudy 概率 0.17,rainny 概率 0.2.给定n天的叶子湿度状态,求这n天最可能的天气情况 分析:概率dp设 dp[i][j] 表示第i天天气为j的最大概率,pre[i][j]表示第i天天气最可能为j的前一天天气,dp[i][j]=max(dp[i-1][k]+log(wePro[k][j])+log(lePro[j][lePos[i]]…
Problem Description PM Room defines a sequence A = {A1, A2,..., AN}, each of which is either 0 or 1. In order to beat him, programmer Moor has to construct another sequence B = {B1, B2,... , BN} of the same length, which satisfies that:   Input The i…
Edward is a worker for Aluminum Cyclic Machinery. His work is operating mechanical arms to cut out designed models. Here is a brief introduction of his work. Assume the operating plane ,) and radius R. Then, m mechanical arms will cut and erase every…
解题报告:题目的意思是输入一个字符串,并规定,里面的“hehe”可以用"wqnmlgb"来代替,也可以不代替,问输入的这个字符串在经过相关的代替之后可以有多少种不同的形态.先打一个斐波那契数的表,f[1] = 1,f[2] =2....,然后从前往后扫一遍字符串,将一段连在一起的"he"一起计算,若这一段里面有 n 个 "he" ,然后这一段就有f[n]种不同的形态,然后一直这样扫下去,把每一段的状态数都相乘,就是最后的结果,不过,要注意的是用到…
思路:一开始对k没有理解好,题意说交换k次,如果我们不需要交换那么多,那么可以重复自己交换自己,那么k其实可以理解为最多交换k次.这道题dfs暴力就行,我们按照全排列最大最小去找每一位应该和后面哪一位交换.k = 0没判断好WA了2发... 如果k >= len - 1,那么最大最小就是直接sort非前导零的答案.如果k < len - 1,那么我们交换肯定从最大位数交换,比如现在求最大值,那么我们从第一位依次判断,如果该位不是他后面最大的,那么就和后面最大的交换(如果最大的有多个,那么就每个…
题意:给你一个规则,问你写的对不对. 思路:规则大概概括为:不能出现前导零,符号两边必须是合法数字.我们先把所有问号改好,再去判断现在是否合法,这样判断比一边改一边判断容易想. 下面的讲解问号只改为+或1... 对于(null)0?,+0?,*0?一律只能改为+,否则必是前导零,其他情况问号改为1,判断情况的时候注意一下i的范围,比如i==0时,s[i - 1]越界. 判断对错时对++,(null)+,+(null)符号两边没数字的判错,如果01前是null或者+*判错. 给几个样例: 0??0…
题意:a数组初始全为0,b数组题目给你,有两种操作: 思路:dls的思路很妙啊,我们可以将a初始化为b,加一操作改为减一,然后我们维护一个最小值,一旦最小值为0,说明至少有一个ai > bi,那么找出所有为0的给他的最终结果加上一并且重置为bi,维护一个区间和,询问时线段树求和.一开始updateMin没加判断,单个复杂度飙到nlog(n),疯狂TLE... 代码: #include<cstdio> #include<vector> #include<stack>…
Balls Rearrangement Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 25    Accepted Submission(s): 8 Problem Description Bob has N balls and A boxes. He numbers the balls from 0 to N-1, and numbe…