08 2012 档案
摘要:#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;
const int INF = 0x3fffffff;
const int V = 200;
int cmp(double a, double b)
{ return a>b;
}
int mai...
阅读全文
摘要:#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;
const int INF = 0x3fffffff;
const int V = 200;
int main()
{ //freopen("in.txt","r",stdin); //freo
阅读全文
摘要:const int INF = 0x3fffffff;
const int V = 200;
int dijkstra(int map[][V],int start,int end,int n) //map为临界矩阵,n为矩阵大小
{ int final[V],track[V],i,j,ant=n*n; memset(track,0,sizeof(track)); for(i=1;i<=n;i++) final[i]=map[start][i]!=0?map[start][i]:INF; track[start]=1; while(ant--) { int judge=1...
阅读全文
摘要:/*
很简单的模版题...Dijkstra应该就不用多说了...算法比较简单...尤其是数据结构中的...所以流程图都有...大家一搜一大堆我就不赘述了...赘述也是多余
给几组数据
3 3
1 2 1
1 3 3
2 3 1
3 1
1 2 1
6 9
1 2 7
1 3 9
1 4 14
2 3 10
2 5 15
3 4 2
3 5 11
4 6 9
5 6 6
6 8
1 3 10
1 5 30
1 6 100
2 3 5
3 4 50
4 6 10
5 4 20
5 6 60 ****************************************************
.
阅读全文
摘要:/******************Kruskal********************/#include #include #include #include #include using namespace std;const int V = 101;int father[V],map[V]...
阅读全文
摘要:最近刚学的并查集所以用kruskal来试试最小生成树~kruskal其实用几句话就能说完~1.贪心所有边的权值,从小到大取值2.取值时~将边权非0的两个顶点~进行并查操作~如果两个点的祖先不同...边权加入最小生成树...并且将两个点纳入同一个集合中3.判断是否所有点都在同一个集合中完毕~下面上代码~这个代码应该可以作为模版了...但是并查集没有优化~所以复杂度约为0(n^3)但是比prim好一点32ms水过...mian()前的代码修改一下可以作为kruskal的模版...我再写一篇专门放模版吧~#include #include #include #include #include...
阅读全文
摘要:Language:ParencodingsTime Limit:1000MSMemory Limit:10000KTotal Submissions:15029Accepted:8959DescriptionLet S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways:q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses before the ith
阅读全文
摘要:#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main()
{
// freopen("in.txt","r",stdin); int a,b; while(cin>>a>>b) { int i,j; b=-b; int x[
阅读全文
摘要:题目很简单...给你N个星星的坐标...找出在m*n的方框中最多能容纳几个星星...直接遍历一遍整个图...属于简单搜索~#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;
int map[501][501]; ...
阅读全文
摘要:颤抖吧凡人~这才是真正的暴力枚举!!!枚举16个点的状态分别判断...真的...这样也能过...#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;
int main()
{
// freopen("in.txt","r",stdin); int a,b,c,d,e
阅读全文
摘要:sort横坐标x...以岛屿为圆心.d为半径画圆...分别计算与x轴的左右交点按照从大到小的顺序(或者从小到大都行)对x轴的交点进行判断...#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;
struct point { double x; double y;
...
阅读全文
摘要:=============================以下是最小生成树+并查集======================================
【HDU】
1213 How Many Tables 基础并查集★
1272 小希的迷宫 基础并查集★
1325&&poj1308 Is It A Tree? 基础并查集★
1856 More is better 基础并查集★
1102 Constructing Roads 基础最小生成树★
1232 畅通工程 基础并查集★
1233 还是畅通工程 基础最小生成树★
1863 畅通...
阅读全文
摘要:How Many TablesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6073Accepted Submission(s): 2894Problem DescriptionToday is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he need
阅读全文
摘要:Sorting It All OutTime Limit:1000MSMemory Limit:10000KTotal Submissions:21042Accepted:7226DescriptionAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted sequence A, B, C, D i
阅读全文