上一页 1 2 3 4 5 6 ··· 8 下一页
摘要: 不知道为什么compile error,第一次用#include "map",可能就是因为这个原因吧,上次有个同学介绍我上一个网站,它可以帮我评定是那一部分出错我的代码#include "iostream"#include "algorithm"#include #include using namespace std;int main(){ int top=1,step,flag1,ncase,n,j,i; char list1[110],list2[110],list3[220],list4[220],endlist[220]; 阅读全文
posted @ 2013-09-30 18:06 龙城星 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 不知道是谁出这道题的...坑爹,又是一开始错,没怎么改动,接着又通过了我的代码ACCEPT#include "iostream"#include "queue"#include "algorithm"#include "string.h"using namespace std;struct Point{ int a,b,count; int list[1000];};int min(int a,int b){return a>b?b:a;}Point tem,ans;int A,B,C;char rea[6] 阅读全文
posted @ 2013-09-30 11:03 龙城星 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 看来没有选好数据类型,毕竟这道题目的数值要求挺高的我的代码没有通过,超时了说说中间遇到什么问题吧tem.list[tem.count]='0'+i; strcpy(ans.list,tem.list);这个代码花了我好几个小时的时间,一开始是直接ans.list[tem.count]='0'+i忽略了ans中tem.count之前的字符虽说超时了,但应该是对的(因为看了人家的代码)#include "iostream"#include "queue"#include "algorithm"#includ 阅读全文
posted @ 2013-09-29 21:00 龙城星 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 因为是三维,所以在变量上老是出问题,最后还是用了xyz来辨别,总算思维清晰了很多,一次性ACCEPT#include "iostream"#include "queue"#include "algorithm"#include "string.h"#define N 35using namespace std;struct Point{ int x,y,z;};int dir[6][3]={0,0,1, 0,0,-1, 0,1,0, 0,-1,0, 1,0,0, -1,0,0};int min(int a,int 阅读全文
posted @ 2013-09-29 14:00 龙城星 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 不知道哪里错了,一开始忘记条件说超过10就输出-1,结果老是超时#include "iostream"#include "algorithm"#define N 10000using namespace std;int rea[4][2]={{0,1},{-1,0},{1,0},{0,-1}};struct{ int x,y;}s,e;int w,h,step,map[25][25],MIN;int min(int a,int b){return a>b?b:a;}void dfs(int x,int y){ int i,j,k; for(i=0; 阅读全文
posted @ 2013-09-28 22:54 龙城星 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 错了好几次,for(j=1;j>n>>m){ step=0;num=0; if(n==-1&&m==-1)break; for(i=1;i>list; for(j=0;j<n;j++){ map[i][j+1]=list[j]; } } memset(set,0,sizeof(set)); dfs(0,0,0); cout<<step<<endl; }} 阅读全文
posted @ 2013-09-28 20:02 龙城星 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 超奇葩的题目。。。。早上错了,下午没有怎么改就通过了.....我的代码#include "iostream"#include "string.h"using namespace std;int map[26][26];int num[8][2]={{-1,-2},{1,-2},{-2,-1},{2,-1},{-2,1},{2,1},{-1,2},{1,2}};int top=0,p,q;struct{ int x,y;}ans[26];bool check(){ int i,j; for(i=1;i=1&&temx=1&& 阅读全文
posted @ 2013-09-27 16:42 龙城星 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 大神的题解题意:给一个包含n个节点的树,然后让你找一颗节点数为p的子树,同时让你删掉最少数目的边把这个子树给孤立起来,问这个最少的边数。思路:很容易想到要用到01背包,要把子树的情况进行背包。用dp[root][j]记录 以root为根的、节点数为j的子树的孤立起来需要删除的最少的边数。状态方程为:dp[root][p]=min(dp[root][p], dp[u][k]+dp[root][p-k]-2);(其中u为root的一个孩子)由于u与root之间的边连接了起来,所以dp[u][k]+dp[root][p-k] 多加了2次他们之间的边,所以要减去2;含义是:我们把以 root 为根的节 阅读全文
posted @ 2013-09-23 09:43 龙城星 阅读(226) 评论(0) 推荐(1) 编辑
摘要: 大神的指导,加上大神的题解文档,我自己照着他的代码打了一遍,通过了详细看看网站http://blog.sina.com.cn/s/blog_5f5353cc0100hd08.html我的ACCEPT代码,想通了就感觉个之前做过的一道聚会的树形dp有点像#include "iostream"#include "algorithm"#include "string.h"#include #define M 1015using namespace std;int tree[M][M],leave[M],success[M],fail[M]; 阅读全文
posted @ 2013-09-21 18:47 龙城星 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 真的是水题一道啊,看懂题意就好了,这是人家的代码....自己懒得做啊,不过看完之后才知道其实应该动下手的....嘻嘻#includeconst int Base10[]={1000,100,10,1};const int Base12[]={1728,144,12,1};const int Base16[]={4096,256,16,1};int main(void){ int Sum10,Sum12,Sum16,i,j,tmp10,tmp12,tmp16; for(i=2992;i<10000;i++) { Sum10=Sum12=Sum16=0; ... 阅读全文
posted @ 2013-09-19 15:50 龙城星 阅读(109) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 8 下一页