上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 42 下一页
摘要: 注意重边!!!!View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<algorithm> 5 #include<iostream> 6 #include<queue> 7 using namespace std; 8 const int maxn = 505; 9 int mat[ maxn ][ maxn ];10 int ind[ maxn ];11 int res[ maxn ];12 int vis[ 阅读全文
posted @ 2013-04-26 16:34 xxx0624 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(250) 评论(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 阅读(231) 评论(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 阅读(246) 评论(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 阅读(906) 评论(0) 推荐(0) 编辑
摘要: 第一道树形DP详细见分析。。View Code 1 #include<stdio.h> 2 #include<string> 3 #include<stdlib.h> 4 #include<map> 5 #include<algorithm> 6 #include<iostream> 7 using namespace std; 8 const int maxn = 205; 9 const int maxm = 40005; 10 struct node{ 11 int u,v,next; 12 }edge[ maxm 阅读全文
posted @ 2013-04-21 00:33 xxx0624 阅读(326) 评论(0) 推荐(0) 编辑
摘要: 一开始TLE了。。View Code 1 /* 2 dfs+TLE 3 题意:给定一些点,求最多能放多少个点,使得这些放的点不互相攻击 4 5 */ 6 #include<stdio.h> 7 #include<string.h> 8 #include<stdlib.h> 9 #include<algorithm> 10 #include<iostream> 11 #include<queue> 12 #include<vector> 13 #include<map> 14 #include< 阅读全文
posted @ 2013-04-20 13:38 xxx0624 阅读(293) 评论(0) 推荐(0) 编辑
摘要: View Code 1 import java.util.*; 2 import java.math.*; 3 import java.text.*; 4 import java.io.* ; 5 6 public class testjava{ 7 public static void... 阅读全文
posted @ 2013-04-17 17:53 xxx0624 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 个人的标准写法。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 l 阅读全文
posted @ 2013-04-15 22:05 xxx0624 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 经典题!!!View Code 1 #include<stdio.h> 2 #include<string.h> 3 const int maxn = 100005; 4 typedef __int64 int64; 5 int64 a[ maxn ]; 6 int64 vis[ maxn ]; 7 int64 cnt[ maxn ]; 8 struct node{ 9 int64 l,r,d;10 }b[ maxn ];11 int main(){12 int64 n,k,m;13 while( scanf("%I64d%I64d%I64d",&a 阅读全文
posted @ 2013-04-12 12:27 xxx0624 阅读(678) 评论(0) 推荐(0) 编辑
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 42 下一页