上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 42 下一页
摘要: 题意:求n个数中的某些数的和等于t,并输出dfs记录下已经输出过的,然后每次比较一下,这样就能避免重复View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<algorithm> 5 using namespace std; 6 const int maxn = 15; 7 const int maxm = 500005; 8 int num[ maxn ]; 9 int vis[ maxn ]; 10 int ans[ maxn ]; 阅读全文
posted @ 2013-02-17 22:47 xxx0624 阅读(491) 评论(0) 推荐(0) 编辑
摘要: 开始觉得是 最长不增序列。。。但是就那么随笔写了俩个for 就AC了。。。。。。估计数据弱吧。。。。View Code 1 #include<stdio.h> 2 const int maxn = 200005; 3 int a[ maxn ],vis[ maxn ]; 4 int main(){ 5 int n; 6 while( scanf("%d",&n)==1 ){ 7 for( int i=1;i<=n;i++ ){ 8 scanf("%d",&a[ i ]); 9 vis[ i ]=0;10 ... 阅读全文
posted @ 2013-02-17 21:41 xxx0624 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 题意:给定一些木棒询问是否能够组成正方形直接暴力 DFSView Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<algorithm> 5 using namespace std; 6 const int maxn = 24; 7 int a[ maxn ]; 8 int vis[ maxn ]; 9 int n ,flag;10 11 void dfs( int pos,int len,int LEN,int sum ){//12 if( 阅读全文
posted @ 2013-02-17 21:16 xxx0624 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 简单View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<algorithm> 5 using namespace std; 6 const int maxn = 1005; 7 struct node{ 8 char mm[ 24 ]; 9 int num;10 int ss;11 }a[ maxn ];12 int b[ 12 ];13 bool cmp( node a,node b ){14 if( a.ss!=b.ss ) re 阅读全文
posted @ 2013-02-17 17:12 xxx0624 阅读(209) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<string.h> 3 const int inf = 9999999; 4 struct node{ 5 int s,e; 6 char m[ 24 ]; 7 }a[505]; 8 int main(){ 9 int t;10 scanf("%d",&t);11 while( t-- ){12 int num;13 char time[24];14 scanf("%d",&num);15 int ans1,... 阅读全文
posted @ 2013-02-17 16:58 xxx0624 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 题意:有a+b计算结果View Code 1 #include<stdio.h> 2 #include<string> 3 #include<stdlib.h> 4 int mp( char a[] ){ 5 if( strcmp(a,"zero")==0 ) 6 return 0; 7 if( strcmp(a,"one")==0 ) 8 return 1; 9 if( strcmp(a,"two")==0 )10 return 2;11 if( strcmp(a,"three" 阅读全文
posted @ 2013-02-17 16:45 xxx0624 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 题意:给定一张图,图中的每个数代表一种颜色的气球求:哪种颜色的气球不能在K次中被消灭( 每次只能消灭一行或者一列 )二分匹配:按照题意来分析 就是要寻找一种消灭方法 使得所有同种气球被消灭 这就符合了最小点覆盖的意义当所有的点(在这里也就是气球的行号和列号 ) 被覆盖,也就是所有的行号和列号被覆盖最小点覆盖=最大匹配View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<queue> 5 #include<math.h> 6 阅读全文
posted @ 2013-02-17 16:01 xxx0624 阅读(359) 评论(0) 推荐(0) 编辑
摘要: 题意:模拟图书馆借书book用于记录 该书 被那个学生借走了pos 用于记录这本书被借走的同学放在了第几位.注意:每次还书 的时候要更新pos!!!!View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<math.h> 4 #include<queue> 5 #include<stdlib.h> 6 #include<algorithm> 7 using namespace std; 8 const int maxn = 100005; 9 const 阅读全文
posted @ 2013-02-17 11:30 xxx0624 阅读(748) 评论(0) 推荐(0) 编辑
摘要: 水题~~题意:满足方程 a*x1*x1+b*x2*x2+c*x3*x3+d*x4*x4=0 的解的个数直接模拟三个for即可View Code 1 #include<stdio.h> 2 #include<math.h> 3 int main(){ 4 int a,b,c,d; 5 while( scanf("%d%d%d%d",&a,&b,&c,&d)!=EOF ){ 6 int ans=0; 7 if(( a>0&&b>0&&c>0&&d>0 阅读全文
posted @ 2013-02-16 21:43 xxx0624 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 题意:三个瓶子,容量为s,n,m,且s装满饮料 s=m+n求至少倒多少下能使得某两个瓶子装着相同多的饮料。bfs 模拟View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<math.h> 4 #include<queue> 5 #include<algorithm> 6 using namespace std; 7 const int maxn = 105; 8 struct node{ 9 int s,n,m,t; 10 }; 11 int s,n,m; 12 i 阅读全文
posted @ 2013-02-16 21:21 xxx0624 阅读(1411) 评论(0) 推荐(0) 编辑
上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 42 下一页