摘要:
View Code 1 /* 2 模拟+回文数 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue>10 #include<vector>11 #include<map>12 #include<math.h>13 typedef long long ll;14 //typedef __in 阅读全文
posted @ 2013-04-24 22:18
xxx0624
阅读(262)
评论(0)
推荐(0)
摘要:
对于状态的处理有点难想。。。View Code 1 /* 2 bfs 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<queue> 7 #include<stdlib.h> 8 #include<algorithm> 9 using namespace std;10 const int maxn = 12;11 const int inf = 99999999;12 int mat[ maxn ][ maxn ];13 int vis[ maxn ][ maxn ];1 阅读全文
posted @ 2013-04-24 21:56
xxx0624
阅读(242)
评论(0)
推荐(0)
摘要:
题意就是要求给定的一张图是否是棵树。。。BFS一遍即可+树的特征。有一组BT数据。。。View Code 1 /* 2 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue> 10 #include<vector> 11 #include<map> 12 #include<math.h> 1 阅读全文
posted @ 2013-04-24 21:15
xxx0624
阅读(258)
评论(0)
推荐(0)
摘要:
详见http://www.cnblogs.com/xiaolongchase/archive/2012/02/10/2344769.htmlView Code 1 /* 2 dp+斜率优化 3 题意:给定一些点,把这些点分成某些行 4 对于分成同一行的点的代价为:( sigma(x)*sigma(x)+m ) 5 求最小的代价 6 dp[ i ] = min( dp[ j ]+(sum[i]-sum[j])^2+m ) (其中j<=i)//以第i个点为末尾的最小代价 7 8 首先对于任意的j,k( j<k<=i ) 9 如果说k的决策由于j,那么可得到dp[ k ]+(sum 阅读全文
posted @ 2013-04-24 20:45
xxx0624
阅读(934)
评论(0)
推荐(0)

浙公网安备 33010602011771号