求助,我没有用数组的方法,但还是没过,求助
查看原帖
求助,我没有用数组的方法,但还是没过,求助
886639
Liangzheng123楼主2022/12/28 17:35
#include <stdio.h>
int main() {
	int n;
	scanf("%d", &n);
	int max=1, count=1;
	int pre,pc;
	for (int i = 1; i <= n; i++) {
		scanf("%d", &pc);
		if (i == 1) { pre = pc; continue; }
		if (pc > pre) {
			count++;
		}
		else {
			if (count > max) {
				max = count;
			}
			count = 1;
		}
		pre = pc;
	}
	printf("%d", max);
	return 0;
}

我用的是比较的方法

2022/12/28 17:35
加载中...