题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=115760#problem/G 题目大意是给出四条边,问能否组成一个四边形,如果可以的话输出最大的四边形的面积,否则输出-1. 判断能否组成四边形和三角形差不多,只要满足任意三条边大于第四条边即可. 而对于计算面积,仓鼠学长给的方法是找两条边,然后二分它们的夹角找出最小的面积即可(因为四条边确定了,再确定一个夹角那么这个四边形的面积也就确定了).然而还有更快的方法. 根据四边形…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4386 Problem Description One day the little Jack is playing a game with four crabsticks. The game is simple, he want to make all the four crabsticks to be a quadrilateral, which has the biggest area in a…
http://acm.hdu.edu.cn/showproblem.php?pid=4386 题意:给四条边长,问能否组成四边形,如果能,求最大面积 求最大面积用海伦公式的四边形推广,p=(a+b+c+d)/2,S=sqrt((p-a)*(p-b)*(p-c)*(p-d)) #include <iostream> #include <cstdio> #include <cstring> #include <map> #include <algorith…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2829 题目大意:有一段铁路有n个站,每个站可以往其他站运送粮草,现在要炸掉m条路使得粮草补给最小,粮草补给的公式是将每个站能收到的粮草的总和. 4----5-----1-----2 粮草总和为4*5 + 4*1 + 4*2 + 5*1 + 5*2 + 1*2 = 49. 4----5       1-----2 粮草总和为4*5 + 1*2 = 22. 4      5-----1------2 粮…
#include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #include<algorithm> #include<queue> #include<cmath> using namespace std; #define Maxn 1010 #define INF 0xfffffff *Maxn],sum[*Maxn]; *Maxn][*M…
T. E. Lawrence was a controversial figure during World War I. He was a British officer who served in the Arabian theater and led a group of Arab nationals in guerilla strikes against the Ottoman Empire. His primary targets were the railroads. A highl…
Problem Description Little D is really interested in the theorem of sets recently. There’s a problem that confused him a long time.  Let T be a set of integers. Let the MIN be the minimum integer in T and MAX be the maximum, then the cost of set T if…
设d(i, j)为连通第i个点到第j个点的树的最小长度,则有状态转移方程: d(i, j) = min{ d(i, k) + d(k + 1, j) + p[k].y - p[j].y + p[k+1].x - p[i].x } 然后用四边形不等式优化之.. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <map> #d…
Lawrence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2484    Accepted Submission(s): 1105 Problem Description T. E. Lawrence was a controversial figure during World War I. He was a British o…
环形石子合并问题. 有一种方法是取模,而如果空间允许的话(或者滚动数组),可以把长度为n个换拓展成长为2n-1的直线. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; + ; const int INF = 0x3f3f3f3f; int n; int a[maxn], sum[maxn]; int d[max…