02_最长上升子串长度
一、测试程序:
1 /*
2 * 最长上升子串长度
3 *
4 */
5
6 #include <stdio.h>
7 #include <string.h>
8
9 #define MAX(a, b) (a)>(b) ? (a):(b)
10
11 int main()
12 {
13 unsigned char str[1024] = {0};
14
15 while (~scanf("%s", str)) {
16 int cnt = 1;
17 int len = 0;
18 int max = 0;
19 int i = 0;
20
21 len = strlen(str);
22 for (; i<len-1; i++) {
23 if (str[i+1] > str[i])
24 cnt++;
25 else
26 cnt = 1;
27
28 max = MAX(max, cnt);
29 }
30
31 printf("%d\n", max);
32 }
33
34 return 0;
35 }
感谢花费宝贵的时间浏览,
转载请注明出处。
本人将在[资源共享]分类下陆续加入学习过程中一些比较重要且有用处的资料、源码,大家可前往下载,一起进步。
感谢支持!

浙公网安备 33010602011771号