简单题。
1 #include2 3 #define MAXN 100005 4 5 int wi[MAXN], li[MAXN]; 6 int diff[MAXN<<1]; 7 8 int main() { 9 int n, total, max;10 int i, tmp;11 12 while (scanf("%d", &n) != EOF) {13 for (i=0; i =0 || total+diff[i]>=0) {20 total += diff[i];21 ++tmp;22 } else {23 if (tmp > max)24 max = tmp;25 tmp = 0;26 total = 0;27 }28 }29 if (tmp && tmp>max)30 max = tmp;31 if (max > n)32 max = n;33 printf("%d\n", max);34 }35 36 return 0;37 }