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

2011年12月25日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3290DFS递归就行了 G++提交TLE C++提交AC了 有些神奇我的代码 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <vector> 5 using namespace std; 6 const int N=20010; 7 vector<int> c[N]; 8 int w[N],n,cw[N],vis[N]; 9 int cmp(const 阅读全文
posted @ 2011-12-25 12:31 Qiuqiqiu 阅读(292) 评论(2) 推荐(0) 编辑

2011年12月24日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2616枚举所有情况,STL直接生成排列View Code 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 int main() 5 { 6 int n,m,a[10],b[10],p[10],ans,i; 7 while (scanf("%d%d",&n,&m)!=EOF) 8 { 9 ans=n+1;10 for (i=1;i<=n;i++) scanf( 阅读全文
posted @ 2011-12-24 18:26 Qiuqiqiu 阅读(198) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1426DFSView Code 1 #include <stdio.h> 2 #include <string.h> 3 int r[10][10],c[10][10],g[10][10],a[10][10],flag; 4 int f(int x,int y) 5 { 6 return (x-1)/3*3+(y-1)/3+1; 7 } 8 void dfs(int u) 9 {10 if (flag) return;11 while ((u%10==0 || a[u/10][u%1. 阅读全文
posted @ 2011-12-24 17:19 Qiuqiqiu 阅读(157) 评论(0) 推荐(0) 编辑

2011年12月17日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1044先BFS求出起始位置,宝石,出口,任意2点的最短距离再DFS搜索所有的可能性我的代码 1 #include <cstdio> 2 #include <cctype> 3 #include <cstring> 4 #include <queue> 5 using namespace std; 6 const int N=60; 7 const int dx[4]={0,1,0,-1}; 8 const int dy[4]={1,0,-1,0}; 9 char 阅读全文
posted @ 2011-12-17 18:17 Qiuqiqiu 阅读(331) 评论(0) 推荐(0) 编辑

2011年12月16日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1372骑士环游 BFS我的代码 1 #include <cstdio> 2 #include <cstring> 3 #include <queue> 4 using namespace std; 5 const int dx[8]={-1,1,2,2,1,-1,-2,-2}; 6 const int dy[8]={2,2,1,-1,-2,-2,-1,1}; 7 int dis[10][10],vis[10][10]; 8 queue<int> q; 9 int 阅读全文
posted @ 2011-12-16 19:45 Qiuqiqiu 阅读(168) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3400嵌套三分 Orz我的代码 1 #include <stdio.h> 2 #include <math.h> 3 const double eps=1e-6; 4 struct point 5 { 6 double x,y; 7 }a,b,c,d; 8 double v1,v2,v3; 9 double dist(point a,point b)10 {11 return sqrt((b.x-a.x)*(b.x-a.x)+(b.y-a.y)*(b.y-a.y));12 }13 do 阅读全文
posted @ 2011-12-16 17:21 Qiuqiqiu 阅读(186) 评论(0) 推荐(0) 编辑
 
摘要: 三分我的代码 1 #include <stdio.h> 2 #include <math.h> 3 const double pi=acos(-1.0),eps=1e-6; 4 double x,y,l,d; 5 double f(double a) 6 { 7 return (l-(y-d*cos(a))/sin(a))*cos(a)+d*sin(a); 8 } 9 double tsearch(double l,double r)10 {11 double m1,m2;12 while (r-l>eps)13 {14 m1=l+(r-l)/3... 阅读全文
posted @ 2011-12-16 16:08 Qiuqiqiu 阅读(280) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2102BFS我的代码 1 #include <cstdio> 2 #include <queue> 3 using namespace std; 4 const int dx[4]={0,1,0,-1}; 5 const int dy[4]={1,0,-1,0}; 6 char maze[2][15][15]; 7 bool vis[2][15][15]; 8 int n,m,t,dis[2][15][15]; 9 queue<int> q;10 int bfs(int x 阅读全文
posted @ 2011-12-16 11:49 Qiuqiqiu 阅读(154) 评论(0) 推荐(0) 编辑

2011年12月12日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2955费用为实数的背包问题,可以考虑把费用和价值换一换,把价值看成费用,费用看成价值。其实就是算构成某一种价值的最小(或最大)费用。我的代码 1 #include <stdio.h> 2 #include <string.h> 3 const int V=10010; 4 double f[V],p[110]; 5 int m[110]; 6 int main() 7 { 8 int T,i,j,n,v; 9 double pp;10 scanf("%d",& 阅读全文
posted @ 2011-12-12 16:45 Qiuqiqiu 阅读(173) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3466直接01背包肯定WA,按q排了下序,还是WA,查了一下是按q-p排序,不知道为什么可能是因为 for (j=n;j>=q;j--) f[j]>?=f[j-p]+w; 先算q-p最小的,而不是q最小的我的代码 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 const int N=510,M=5010; 5 struct item 6 { 7 int p,q,v; 8 }a 阅读全文
posted @ 2011-12-12 15:22 Qiuqiqiu 阅读(209) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 20 下一页