上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 42 下一页
摘要: 题意:从一个4位数到另一个4位数 所需的步数bfsView Code 1 #include<stdio.h> 2 #include<string> 3 #include<stdlib.h> 4 #include<queue> 5 #include<algorithm> 6 #include<iostream> 7 #include<map> 8 using namespace std; 9 const int maxn = 10;10 char a[maxn],b[maxn];11 int vis[ 10000 阅读全文
posted @ 2013-02-16 10:39 xxx0624 阅读(357) 评论(0) 推荐(0) 编辑
摘要: 两题基本相同都是关于转弯不能超过某个数,所以有些点可能重复走,所以要设time[][]数组来记录上次走过的时间!!!!记得初始化queue!!!HDU1175View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<queue> 5 #include<algorithm> 6 using namespace std; 7 const int dx[]={0,0,1,-1}; 8 const int dy[]={1,-1,0,0} 阅读全文
posted @ 2013-02-15 14:57 xxx0624 阅读(903) 评论(0) 推荐(0) 编辑
摘要: 分别从s,e出发进行bfs注意讨论的部分即可。详见代码:View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<queue> 5 #include<map> 6 #include<algorithm> 7 using namespace std; 8 const int maxn = 8; 9 const int inf = 123456789; 10 struct node{ 11 int x,y; 12 }; 阅读全文
posted @ 2013-02-14 23:02 xxx0624 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 题意:有上一状态到下一状态单向bfs就是每次只改变一个点的一个方向!!!( 参考。。。http://blog.csdn.net/cscj2010/article/details/7371482)View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<queue> 5 #include<algorithm> 6 using namespace std; 7 const int maxn = 8; 8 bool vis[ maxn 阅读全文
posted @ 2013-02-14 21:36 xxx0624 阅读(334) 评论(0) 推荐(0) 编辑
摘要: 水~但是如果不找出公式的话,而用for(角度),这样会TLE。。。。View Code 1 #include<stdio.h> 2 #include<math.h> 3 #include<algorithm> 4 using namespace std; 5 const double pi=3.141592653; 6 int main(){ 7 double x,y,v; 8 while( scanf("%lf%lf%lf",&x,&y,&v)==3,x+y+v ){ 9 double ans=0;10 /*11 阅读全文
posted @ 2013-02-13 17:16 xxx0624 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 注意:先处理出起点的整个body,并存储在form中,然后再建个新的图flag,再就是普通的bfs了。。。。。参考:http://blog.csdn.net/ice_crazy/article/details/7594362View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<queue> 5 #include<algorithm> 6 using namespace std; 7 const int maxn = 105; 阅读全文
posted @ 2013-02-13 16:23 xxx0624 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 题意:给定一个凸多边形和一条直线求这个多边形被切割后的面积对于代码中的“d1=dblcmp(s1=cross( p.node[i],s,e ));//跨立 d2=dblcmp(s2=cross( p.node[i+1],s,e ));//跨立”不是很理解。。。求指教View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<math.h> 5 #include<algorithm> 6 using namespace std; 7 阅读全文
posted @ 2013-02-13 16:22 xxx0624 阅读(595) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/xxx0624赶脚这里有点冷清。。。http://blog.csdn.net/xxx0624 阅读全文
posted @ 2013-02-13 10:36 xxx0624 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 水~View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<algorithm> 5 #include<map> 6 using namespace std; 7 int in[ 10 ],sum[ 8 ]; 8 /* 9 BCG 1 2 3//(12)(34)(68)10 BGC 1 3 2//(12)(35)(67)11 12 CBG 2 1 3//(01)(45)(68)13 CGB 2 3 1//(01)(35)(78 阅读全文
posted @ 2013-02-10 22:47 xxx0624 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 题意:卡特兰数+n!java!View Code 1 import java.math.BigInteger; 2 import java.util.*; 3 4 public class HDU1131{ 5 public static void main( String args[] ){ 6 int n; 7 Scanner cin=new Scanner(System.in); 8 BigInteger h[]=new BigInteger[ 105 ]; 9 h[ 0 ]=h[ 1 ]=BigInteger.... 阅读全文
posted @ 2013-02-10 22:06 xxx0624 阅读(366) 评论(0) 推荐(0) 编辑
上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 42 下一页