摘要: 1.最长连续序列。比如 abccccfa,最长连续序列为cccc,长度为4思路:另开一个数组记录到目前位置最长连续序列长度。每个位置的字符(除第一个)和前一个比较,相同+1,不同标为1图示:代码:#include #include int main(){ char s[10] = "abccccfa"; int num[10] = {0}; char tmp; int maxpos, maxval, i; num [0] = 1; maxpos = 0; tmp = s[0]; for(i = 1; i num[maxpos]) ... 阅读全文
posted @ 2013-05-15 23:54 jihite 阅读(3559) 评论(0) 推荐(0) 编辑