上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 19 下一页
摘要: 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1253三维的BFS,跟地下城那道题很像。不用怎么解释。题目上说的很清楚。View Code 1 #include <stdio.h> 2 #include <string.h> 3 struct node 4 { 5 int x,y,z; 6 int t; 7 }q[1000005]; 8 int map[55][55][55]; 9 int pro[55][55][55],f,r;10 int to[6][3] = {{0,0,1},{0,0,-1},{0,1,0},{0,- 阅读全文
posted @ 2012-08-01 20:27 某某。 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1241题目大意是@是可以走的,让你找出是不是有几块是连载一起的。跟挑战编程上的一道题木很想、View Code 1 #include <stdio.h> 2 #include <string.h> 3 4 char map[110][110]; 5 int vis[110][110]; 6 int to[8][2] = {{0,1},{0,-1},{1,0},{1,1},{1,-1},{-1,0},{-1,1},{-1,-1}}; 7 int n,m,count; 8 9 vo 阅读全文
posted @ 2012-08-01 20:25 某某。 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1015题目的大意就是给以一串字符串和一个目标数字,让你从中找出5个字母,依次可以满足v - w^2 + x^3 - y^4 + z^5 = target这个关系式如果有多个就按字典序最大的输出。。。View Code #include <stdio.h>#include <string.h>#include <stdlib.h>int vis[100005];char str[100005];int sum,leap;char end[10],temp[10];in 阅读全文
posted @ 2012-08-01 20:21 某某。 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 题目理解听想人,就是看有没有办法让b变成m。View Code 1 #include<stdio.h> 2 #include<string.h> 3 int q[100000]; 4 int map[30][30]; 5 int pro[100000]; 6 int f,r; 7 8 int main() 9 {10 int n,i,j,len,leap;11 char s[200];12 while(scanf("%s",s) != EOF)13 {14 leap = 0;15 memset(map,0,sizeof(map... 阅读全文
posted @ 2012-07-31 18:54 某某。 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=2251这道题坑爹的地方在于。。。我很悲剧的一个变量写错了~View Code #include <iostream>#include <stdio.h>#include <string.h>using namespace std;char map[35][35][35];int pro[35][35][35];int fro,re;struct node{ int l,r,c,step;}q[100005],v;int main(){ int r,l,c,i,j,k,leap,ii,jj,num 阅读全文
posted @ 2012-07-31 17:12 某某。 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 一开始我看见那个simple out的时候很无语比我的数差好多感觉好大,以为是应该用2进制表示后来发现时special judge~~开始的时候数组要开的大一点。。。我re了两次没找到错然后加了3个零然后A掉View Code #include <stdio.h>__int64 q[10000005],res;int f,r;int main(){ __int64 n,i; while(scanf("%I64d",&n)&&n) { f = r = 0; q[r++] = 1; while(f != r) { ... 阅读全文
posted @ 2012-07-31 11:26 某某。 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 题目连接http://poj.org/problem?id=3278一开始作者道题的时候re了好几次。不知道为什么后来交的时候又WA然后发现得分情况一种是大于等于一种是小于一天刚学会就A了三道题比较满意。View Code #include<stdio.h>#include<string.h>struct node { int step; int i;}q[500005];int pro[500005];int fro,re;int main(){ int farm,cow; while(scanf("%d %d",&farm,&co 阅读全文
posted @ 2012-07-28 00:13 某某。 阅读(140) 评论(0) 推荐(0) 编辑
摘要: fro < re 然后用结构体记录上一步的步数。View Code 图结构练习——BFS——从起始点到目标点的最短步数#include<stdio.h>#include<string.h>int map[1005][1005];struct node{ int i; int count;} q[2005];int pro[1005];int fro;int re;int main(){ int d,e,s,i,j,a,b,t; while(scanf("%d %d",&d,&e) != EOF) { memset(map,0,s 阅读全文
posted @ 2012-07-27 20:10 某某。 阅读(372) 评论(0) 推荐(0) 编辑
摘要: View Code #include<stdio.h>#include<string.h>int map[105][105];int q[210];int pro[105];int fro;int re;int main(){ int d,e,s,i,j,a,b,t; scanf("%d",&t); while(t--) { memset(map,0,sizeof(map)); memset(pro,0,sizeof(pro)); scanf("%d %d %d",&d,&e,&s); for(i 阅读全文
posted @ 2012-07-27 16:26 某某。 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 典型的字典树使用一个flag来标记是否是一个句子。现在我们可以用一个cout来标记这条路径是否有单词存在过,存在过几次连接http://poj.org/problem?id=2001View Code #include <iostream>#include<stdio.h>#include<stdlib.h>#include<string.h>using namespace std;struct node{ int count;//用来存有多少个单词存在过。 int next[27];}word[20100];int num = 0;char s 阅读全文
posted @ 2012-07-26 17:45 某某。 阅读(150) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 19 下一页