Qiuqiqiu  
不管道路多么崎岖坎坷,我永远不停下追逐梦想的脚步!
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 20 下一页

2011年12月12日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3496二维费用的01背包问题,其中一维费用必须装满,赋初值为负无穷打,另一维不用装满,赋初值为0我的代码 1 #include <stdio.h> 2 #include <string.h> 3 const int N=110,INF=0x3fffffff; 4 int f[N][1010],c[N],w[N]; 5 int main() 6 { 7 int T,m,n,l,i,j,k; 8 scanf("%d",&T); 9 while (T--)10 { 阅读全文
posted @ 2011-12-12 13:40 Qiuqiqiu 阅读(208) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2844背包问题我的代码 1 #include <stdio.h> 2 #include <string.h> 3 const int M=100010,N=1010;; 4 int f[M],a[N],c[N]; 5 int main() 6 { 7 int n,m,i,j,k,cc; 8 while (scanf("%d%d",&n,&m) && (n||m)) 9 {10 for (i=1;i<=n;i++) scanf(& 阅读全文
posted @ 2011-12-12 13:07 Qiuqiqiu 阅读(140) 评论(0) 推荐(0) 编辑

2011年12月10日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1171多重背包我的代码 1 #include <stdio.h> 2 #include <string.h> 3 const int N=250010; 4 int f[N],v[60],c[60]; 5 int main() 6 { 7 int n,i,j,k,s,ss,cc; 8 while (scanf("%d",&n) && n>=0) 9 {10 memset(f,0,sizeof(f)); f[0]=1;11 ss=0;12 阅读全文
posted @ 2011-12-10 20:38 Qiuqiqiu 阅读(215) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1010DFS我的代码 1 #include <stdio.h> 2 #include <stdlib.h> 3 const int dx[]={0,1,0,-1}; 4 const int dy[]={1,0,-1,0}; 5 int n,m,t,sx,sy,ex,ey,ans; 6 char maze[10][10]; 7 void dfs(int x,int y,int s) 8 { 9 if (ans) return;10 if (abs(ex-x)+abs(ey-y)+s> 阅读全文
posted @ 2011-12-10 19:39 Qiuqiqiu 阅读(167) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2899三分法我的代码 1 #include <stdio.h> 2 #include <math.h> 3 const double eps=1e-8; 4 double y; 5 double f(double x) 6 { 7 return 6*pow(x,7)+8*pow(x,6)+7*x*x*x+5*x*x-y*x; 8 } 9 int main()10 {11 int T;12 double l,r,ml,mr;13 scanf("%d",&T); 阅读全文
posted @ 2011-12-10 18:32 Qiuqiqiu 阅读(274) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1969二分法我的代码 1 #include <stdio.h> 2 #include <math.h> 3 const double eps=1e-6; 4 const double pi=acos(-1.0); 5 const int N=10010; 6 double a[N]; 7 int n,f; 8 int ok(double m) 9 {10 int i,cnt=0;11 for (i=1;i<=n;i++)12 cnt+=(int)(a[i]/m);13 ... 阅读全文
posted @ 2011-12-10 17:04 Qiuqiqiu 阅读(166) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1102并查集我的代码 1 #include <stdio.h> 2 #include <stdlib.h> 3 const int N=110; 4 struct edge 5 { 6 int u,v,w; 7 }e[N*N]; 8 int a[N][N],set[N]; 9 int cmp(const void *a,const void *b)10 {11 return ((edge*)a)->w - ((edge*)b)->w;12 }13 int find(int 阅读全文
posted @ 2011-12-10 15:47 Qiuqiqiu 阅读(159) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2648我的代码 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 struct shop 5 { 6 char name[50]; 7 int p; 8 }a[10010]; 9 const char like[]="memory";10 int n;11 int cmp1(const void *a,const void *b)12 {13 return strcmp(((s 阅读全文
posted @ 2011-12-10 15:13 Qiuqiqiu 阅读(276) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2289我的代码 1 #include <stdio.h> 2 #include <math.h> 3 double r1,r2,h,v; 4 const double pi=acos(-1.0),esp=1e-9; 5 double f(double x) 6 { 7 double r=(r2-r1)*x/h+r1; 8 return (r1*r1+r*r+r1*r)*pi*x/3; 9 }10 int main()11 {12 int T;13 double l,r,m;14... 阅读全文
posted @ 2011-12-10 15:12 Qiuqiqiu 阅读(170) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2141先把A和B合并为1个序列,再用二分查找我的代码 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 const int N=510; 5 int a[N],b[N],c[N],d[N*N]; 6 int find(int x,int *a,int l,int r) 7 { 8 int m; 9 while (l<r)10 {11 m=(l+r)/2;12 if (x... 阅读全文
posted @ 2011-12-10 15:09 Qiuqiqiu 阅读(177) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 20 下一页