2012年8月2日

UVA 400 Unix ls

摘要: 字符串,需要注意格式,和样例输出用fc命令比较,一致时就行了。# include <cstdio># include <cstring># include <cstdlib># include <cmath># define N 100 + 5# define M 60 + 5int n;char fname[N][M];int cmp(const void *x, const void *y){ return strcmp((char*)x, (char*)y);}int max(int x, int y){ return x>y ? x 阅读全文

posted @ 2012-08-02 17:01 getgoing 阅读(198) 评论(0) 推荐(0) 编辑

UVA 10115 Automatic Editing

摘要: 字符串函数的应用。# include <cstdio># include <cstring># define RULESN 10 + 5# define MAXLEN 80 + 5int n;char src[RULESN][MAXLEN];char des[RULESN][MAXLEN];char text[4 * MAXLEN];void replace(char *t, char *s, char *d){ int len = strlen(s); char *p, tmp[4 * MAXLEN]; while (p = strstr(t, s)) { ... 阅读全文

posted @ 2012-08-02 16:21 getgoing 阅读(172) 评论(0) 推荐(0) 编辑

UVA 644 - Immediate Decodability

摘要: 枚举。第一次遇见:Your submission with number ***** for the problem 644 - Immediate Decodability has failed with verdict ./* 644 - Immediate Decodability*/# include <cstdio># include <cstring>int n;char s[10][15];bool in(char *p, char *t){ for (int i = 0; p[i]; ++i) if (!t[i] || p[i] != t[i]) re. 阅读全文

posted @ 2012-08-02 15:57 getgoing 阅读(215) 评论(0) 推荐(0) 编辑

COJ 1259: 跳跳

摘要: BFS,直接入队即可。# include <cstdio># include <queue># include <cstring>using namespace std;# define N 100 + 5int n;char g[N][N];char vis[N][N];struct pos{int x, y, d;};pos st;queue <pos> Qst[10];const int dx[] = {0,0,1,-1};const int dy[] = {1,-1,0,0};int bfs(void){ queue <pos> 阅读全文

posted @ 2012-08-02 08:36 getgoing 阅读(211) 评论(0) 推荐(0) 编辑

HDOJ 4308 Saving Princess claire_

摘要: 简单BFS,遇到'P'时把所有'P'标记,并对所有'P'多向下搜索一步,此时遇到'*'时入队;BFS的特点:搜到即标记,搜到就判断。# include <cstdio># include <cstring># include <queue>using namespace std;# define N 5000+5int n, m, cost;char g[N][N];char vis[N][N];struct pos{ int x, y, d; pos() { d = 0; }};pos st; 阅读全文

posted @ 2012-08-02 07:17 getgoing 阅读(205) 评论(0) 推荐(0) 编辑

导航