摘要: http://poj.org/problem?id=1850 -----------------http://poj.org/problem?id=1496 两题解法类似。。本题为组合数学的题,要求所给字符串在排列中的位置。所用的方法为暴力枚举。 对于长度为1的字符串有a,b,c,d.......26个;长度为2的字符串有 a开头时有ab,ac,ad,ae,af.....(25,1) 25个 //()为组合数 b开头时有bc,bd,de,.....(24,1) 24个 c开头时有cd,ce,cf。。。(23,1) 23个 。。... 阅读全文
posted @ 2013-07-17 17:41 夜晓楼 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 一道字符串的题。。不过。。挺麻烦的。。。 1 #include 2 #include 3 using namespace std; 4 char dic[10005][20]; 5 char word[55][20]; 6 int diclen[10005];//字典中每个单词的长度 7 8 bool change(char *a, char *b){ 9 int dif = 0; 10 while(*a){ 11 if(*(a++)!=*(b++)){ 12 dif++;//记录不相同的字符的个数,如果大于1就不合... 阅读全文
posted @ 2013-07-17 12:21 夜晓楼 阅读(210) 评论(0) 推荐(0) 编辑