摘要: View Code 1 1001 这个就不用说了吧 2 1002 简单的大数 3 1003 DP经典问题,最大连续子段和 4 1004 简单题 5 1005 找规律(循环点) 6 1006 感觉有点BT的题,我到现在还没过 7 1007 经典问题,最近点对问题,用分治 8 1008 简单题 9 1009 贪心 10 1010 搜索题,剪枝很关键 11 1011 12 1012 简单题 13 1013 简单题(有个小陷阱) 14 1014 简单题 15 1015 可以看作搜索题吧 16 1016 经典的搜索 17 1017 简单数学题 18 1018 简单数学题 19 10... 阅读全文
posted @ 2012-03-29 21:23 keepmoving89 阅读(181) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1162 最小生成树prim算法View Code 1 //*最小生成树,prim算法*/ 2 #include<iostream> 3 #include<cstring> 4 #include<cmath> 5 #include<cfloat>//DBL_MAX 6 #include<iomanip> 7 using namespace std; 8 struct node 9 {10 double x,y;11 };12 node point[10 阅读全文
posted @ 2012-03-29 21:10 keepmoving89 阅读(155) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1142 Dijkstra求最短路径,记录最短路径的条数,cnt记录最短路径的条数出错,不知道错在哪里?View Code 1 #include<iostream> 2 #include<cstring> 3 #include<climits> 4 #include<cmath> 5 using namespace std; 6 #define M 2000000 7 int mat[1008][1008]; 8 bool visited[1008]; 9 int 阅读全文
posted @ 2012-03-29 20:30 keepmoving89 阅读(161) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1213 并查集View Code 1 #include<iostream> 2 #include<algorithm> 3 #include<climits> 4 #include<cstdio> 5 using namespace std; 6 int father[1008]; 7 int t,n,m; 8 void init(int n) 9 {10 for(int i=0;i<=n;i++) father[i]=i;11 }12 int find( 阅读全文
posted @ 2012-03-29 11:20 keepmoving89 阅读(156) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1075 map实现View Code 1 /*map实现,翻译*/ 2 #include<iostream> 3 #include<cstring> 4 #include<cstdlib> 5 #include<map> 6 using namespace std; 7 map<string,string>mat; 8 void print(string s)//找出s对应的英语单词 9 {10 if(mat[s].length()) printf( 阅读全文
posted @ 2012-03-29 09:58 keepmoving89 阅读(145) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1075字典树View Code 1 /*字典树,翻译*/ 2 #include<iostream> 3 #include<cstring> 4 #include<cstdlib> 5 using namespace std; 6 struct node 7 { 8 node* child[26]; 9 char word[12];10 };11 node*root=new node();12 void init()//初始化 13 {14 for(int i=0;i< 阅读全文
posted @ 2012-03-29 08:24 keepmoving89 阅读(228) 评论(0) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?id=1399View Code 1 #include<iostream> 2 #include<algorithm> 3 #include<cstdio> 4 #include<cmath> 5 using namespace std; 6 struct node 7 { 8 int w,v;//这里改成double 会超时 9 };10 node item[100008];11 bool cmp(const node &a,const node &b)12 {13 阅读全文
posted @ 2012-03-28 21:48 keepmoving89 阅读(271) 评论(1) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?id=1420View Code 1 #include<iostream> 2 #include<cstring> 3 #include<cmath> 4 #include<cstdlib> 5 using namespace std; 6 int main() 7 { 8 int n; 9 while(cin>>n)10 {11 int *a=new int[n];12 int i,j,sum=0;13 for(i=0;i<n;i++) cin>>a[ 阅读全文
posted @ 2012-03-28 19:50 keepmoving89 阅读(227) 评论(0) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?id=1335View Code 1 /*宽度搜索,注意对于宽度搜索树中 ,第几层的记录, 2 层数即是最短步数*/ 3 #include<iostream> 4 #include<cstdio> 5 #include<queue> 6 using namespace std; 7 class node 8 { 9 public: node(int x1,int y1,int deep1)10 {11 x=x1;12 y=y1;13 deep=deep1;14 }15 ... 阅读全文
posted @ 2012-03-28 19:47 keepmoving89 阅读(360) 评论(0) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?id=1402 用map超时了View Code 1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 #include<bitset> 5 #include<climits> 6 using namespace std; 7 int main() 8 { 9 bitset<1000008>b1,b2;//放到main外面,编译通不过? 10 int n,x,i;11 while(scanf 阅读全文
posted @ 2012-03-28 17:20 keepmoving89 阅读(236) 评论(0) 推荐(0) 编辑