Qiuqiqiu  
不管道路多么崎岖坎坷,我永远不停下追逐梦想的脚步!

2011年12月7日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2757BFS+优先队列我的代码 1 #include <cstdio> 2 #include <cstring> 3 #include <queue> 4 using namespace std; 5 const int N=1010,INF=10000; 6 struct sta 7 { 8 int x,y,d; 9 };10 struct qcmp11 {12 bool operator() (const sta a,const sta b)13 {14 retur.. 阅读全文
posted @ 2011-12-07 15:18 Qiuqiqiu 阅读(251) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1026BFS+优先队列我的代码 1 #include <cstdio> 2 #include <cstring> 3 #include <queue> 4 using namespace std; 5 typedef pair<int,int> pii; 6 priority_queue<pii,vector<pii>,greater<pii> >q; 7 const int N=110; 8 const int dx[4]= 阅读全文
posted @ 2011-12-07 12:49 Qiuqiqiu 阅读(180) 评论(0) 推荐(0) 编辑

2011年12月3日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1069类似于最长下降子序列我的代码 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 const int N=100; 5 struct block 6 { 7 int x,y,z; 8 }a[N]; 9 int f[N];10 int cmp(const void *a,const void *b)11 {12 return ((block*)b)->x - ((block*)a)- 阅读全文
posted @ 2011-12-03 22:10 Qiuqiqiu 阅读(179) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1063高精度我的代码 1 #include <stdio.h> 2 #include <string.h> 3 4 const int base=10; 5 int a[200],b[10]; 6 void mult2(int *a,int *b) 7 { 8 int i,j; 9 for (i=a[0];i>0;i--)10 {11 for (j=b[0];j>1;j--) a[i+j-1]+=a[i]*b[j];12 a[i]*=b[1];13 ... 阅读全文
posted @ 2011-12-03 17:54 Qiuqiqiu 阅读(197) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1133我的代码 1 #include <stdio.h> 2 #include <string.h> 3 4 const int N=101,base=10000000; 5 int f[N][N][N]; 6 void plus(int *a,int *b) 7 { 8 int i; 9 if (b[0]>a[0]) a[0]=b[0];10 for (i=1;i<=a[0];i++)11 {12 a[i]+=b[i];13 if (a[i]... 阅读全文
posted @ 2011-12-03 16:00 Qiuqiqiu 阅读(326) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1134高精度卡塔兰数我的代码 1 //HDU 1134 2 3 #include <stdio.h> 4 const int base=10000000; 5 int a[100]; 6 void mult(int *a,int b) 7 { 8 int i; 9 a[1]*=b;10 for (i=2;i<=a[0];i++)11 {12 a[i]=a[i]*b+a[i-1]/base;13 a[i-1]%=base;14 }15 ... 阅读全文
posted @ 2011-12-03 15:44 Qiuqiqiu 阅读(219) 评论(0) 推荐(0) 编辑

2011年12月2日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3625斯特林(stirling)数我的代码 1 #include <stdio.h> 2 #include <string.h> 3 const int N=21; 4 double s[N][N],f[N]; 5 void stir() 6 { 7 memset(s,0,sizeof(s)); 8 s[1][1]=1; 9 int i,j;10 for (i=2;i<N;i++)11 for (j=1;j<=i;j++)12 s[i][... 阅读全文
posted @ 2011-12-02 22:56 Qiuqiqiu 阅读(235) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1023卡塔兰(Catalan)数我的代码 1 #include <stdio.h> 2 #include <string.h> 3 const int L=100,base=100000; 4 void print(int *a) 5 { 6 printf("%d",a[a[0]]); 7 for (int i=a[0]-1;i>0;i--) printf("%05d",a[i]); 8 printf("\n"); 9 阅读全文
posted @ 2011-12-02 22:54 Qiuqiqiu 阅读(188) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1879并查集我的代码 1 #include <stdio.h> 2 #include <stdlib.h> 3 const int M=10000,N=110; 4 struct edge 5 { 6 int u,v,w; 7 }e[M]; 8 int set[N],n,m; 9 int cmp(const void *a,const void *b)10 {11 return ((edge*)a)->w - ((edge*)b)->w;12 }13 int find(in 阅读全文
posted @ 2011-12-02 10:29 Qiuqiqiu 阅读(237) 评论(0) 推荐(1) 编辑

2011年12月1日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1233赤裸裸的最小生成树Kruskal我的代码 1 #include <stdio.h> 2 #include <stdlib.h> 3 const int M=10000,N=100; 4 struct edge 5 { 6 int u,v,w; 7 }e[M]; 8 int set[N],n,m; 9 int cmp(const void *a,const void *b)10 {11 return ((edge*)a)->w - ((edge*)b)->w;12 }1 阅读全文
posted @ 2011-12-01 21:51 Qiuqiqiu 阅读(120) 评论(0) 推荐(0) 编辑