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... 阅读全文
posted @ 2012-08-19 10:23 Felix_F 阅读(153) 评论(0) 推荐(0) 编辑
摘要:#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 阅读全文
posted @ 2012-08-19 10:02 Felix_F 阅读(85) 评论(0) 推荐(0) 编辑
摘要: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... 阅读全文
posted @ 2012-08-14 21:30 Felix_F 阅读(173) 评论(0) 推荐(0) 编辑
摘要:/* 很简单的模版题...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 **************************************************** . 阅读全文
posted @ 2012-08-14 13:21 Felix_F 阅读(130) 评论(0) 推荐(0) 编辑
摘要:/******************Kruskal********************/#include #include #include #include #include using namespace std;const int V = 101;int father[V],map[V]... 阅读全文
posted @ 2012-08-10 02:13 Felix_F 阅读(160) 评论(0) 推荐(0) 编辑
摘要:最近刚学的并查集所以用kruskal来试试最小生成树~kruskal其实用几句话就能说完~1.贪心所有边的权值,从小到大取值2.取值时~将边权非0的两个顶点~进行并查操作~如果两个点的祖先不同...边权加入最小生成树...并且将两个点纳入同一个集合中3.判断是否所有点都在同一个集合中完毕~下面上代码~这个代码应该可以作为模版了...但是并查集没有优化~所以复杂度约为0(n^3)但是比prim好一点32ms水过...mian()前的代码修改一下可以作为kruskal的模版...我再写一篇专门放模版吧~#include #include #include #include #include... 阅读全文
posted @ 2012-08-10 02:01 Felix_F 阅读(157) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2012-08-09 12:44 Felix_F 阅读(179) 评论(0) 推荐(0) 编辑
摘要:#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[ 阅读全文
posted @ 2012-08-09 09:04 Felix_F 阅读(107) 评论(0) 推荐(0) 编辑
摘要:题目很简单...给你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]; ... 阅读全文
posted @ 2012-08-09 02:34 Felix_F 阅读(124) 评论(0) 推荐(0) 编辑
摘要:颤抖吧凡人~这才是真正的暴力枚举!!!枚举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 阅读全文
posted @ 2012-08-08 06:31 Felix_F 阅读(138) 评论(0) 推荐(0) 编辑
摘要: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; ... 阅读全文
posted @ 2012-08-07 19:08 Felix_F 阅读(106) 评论(0) 推荐(0) 编辑
摘要:=============================以下是最小生成树+并查集====================================== 【HDU】 1213 How Many Tables 基础并查集★ 1272 小希的迷宫 基础并查集★ 1325&&poj1308 Is It A Tree? 基础并查集★ 1856 More is better 基础并查集★ 1102 Constructing Roads 基础最小生成树★ 1232 畅通工程 基础并查集★ 1233 还是畅通工程 基础最小生成树★ 1863 畅通... 阅读全文
posted @ 2012-08-05 20:35 Felix_F 阅读(155) 评论(0) 推荐(1) 编辑
摘要: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 阅读全文
posted @ 2012-08-05 10:24 Felix_F 阅读(100) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2012-08-03 17:19 Felix_F 阅读(132) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示