上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 71 下一页
摘要: http://poj.org/problem?id=2186用tarjan算出强连通分量的个数 将其缩点 连成一棵树 则题目所求即变成求出度为0 的那个节点 在树中是唯一的 即树根 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 #define M 50010 9 #define N 10010 10 struct node 11 { 12 int u,v,next; 13 }edge[M*2]; 14 in... 阅读全文
posted @ 2013-06-18 17:14 _雨 阅读(163) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3694用tarjan算出桥,用lca算出公共祖先 把路上的边更新掉 原来的桥变为不是桥 看一解题报告感觉有一部分是不用加的 不知道是不是数据水 没加交上也A了。。 1 #include 2 #include 3 #include 4 #... 阅读全文
posted @ 2013-06-17 23:38 _雨 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 枚举 1 #include 2 /* 3 ID: shangca2 4 LANG: C++ 5 TASK: fact4 6 */ 7 #include 8 #include 9 #include10 11 using namespace std;12 int di[5000];13 int main()14 {15 freopen("fact4.in","r",stdin);16 freopen("fact4.out","w",stdout);17 int i,j,k,n,g=0;18 di[0] = 1;19 c 阅读全文
posted @ 2013-06-07 03:12 _雨 阅读(156) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2398跟2318一样 数据还少些 直接枚举的 2318还用了二分 叉积判左右 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<iostream> 5 #include<stdlib.h> 6 #include<algorithm> 7 #include<cmath> 8 using namespace std; 9 struct pointt10 {11 doub 阅读全文
posted @ 2013-05-28 21:05 _雨 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 对dp很无奈。。枚举所有可能达到的值 dp[i]表示到达i值所用最少的邮票 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: stamps 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring> 9 #include<stdlib.h>10 #include<algorithm>11 using namespace std;12 int p[55],dp[2000010];13 bool o[2000010];14 int mai 阅读全文
posted @ 2013-05-28 19:32 _雨 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 又从cuishen 那学了新东西。。map是可以输出的。。还有这个字符串的输入方式挺高端的 学习了。。之后就是暴力枚举就行了 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: contact 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring> 9 #include<algorithm>10 #include<stdlib.h>11 #include<cmath>12 #include<map>13 #i 阅读全文
posted @ 2013-05-27 21:40 _雨 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 参考着崔神写的 离散化为小矩形 再依次判断是否在所给矩形中 之前比赛做过一道类似的 1 /* 2 ID:shangca2 3 PROG:rect1 4 LANG:C++ 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring> 9 #include<algorithm>10 #include<stdlib.h>11 #include<cmath>12 using namespace std;13 int x1[1010],x2[1010],y2[10 阅读全文
posted @ 2013-05-27 16:22 _雨 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 找一个最小的 p*h 比最后一个已经找出来的humble数大 那它肯定是下一个humble数 依次找下去 1 /* 2 ID:shangca2 3 PROG:humble 4 LANG:C++ 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring> 9 #include<algorithm>10 #include<stdlib.h>11 #define INF 0x7fffffff12 using namespace std;13 long long num[ 阅读全文
posted @ 2013-05-25 21:13 _雨 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 转自 http://blog.sina.com.cn/s/blog_49c5866c0100f3om.html其实也谈不上推荐,只是自己做过的题目而已,甚至有的题目尚未AC,让在挣扎中。之所以推荐计算几何题,是因为,本人感觉ACM各种算法中计算几何算是比较实际的算法,在很多领域有着重要的用途 计算几何题的特点与做题要领: 1.大部分不会很难,少部分题目思路很巧妙 2.做计算几何题目,模板很重要,模板必须高度可靠。 3.要注意代码的组织,因为计算几何的题目很容易上两百行代码,里面大部分是模板。如果代码一片混乱,那么会严重影响做题正确率。 4.注意精度控制。 5.能用整数的地方尽量用整数,要想到扩 阅读全文
posted @ 2013-05-17 10:37 _雨 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 来打个酱油 3.1是最小生成树模板View Code 1 /* 2 ID: shangca 3 LANG: C++ 4 TASK: inflate 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring> 9 #include<algorithm>10 #include<stdlib.h>11 using namespace std;12 int c[10010],w[10010],dp[10010];13 int main()14 {15 freopen(&q 阅读全文
posted @ 2013-05-03 21:00 _雨 阅读(177) 评论(0) 推荐(0) 编辑
上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 71 下一页