标签:int return code i++ 个数 连续 col style pre
int n, a[5000]; int main(){ scanf("%d", &n); for (int i = 1; i <= n; i++)cin >> a[i]; ll cur = 0, ans = 0, l, r, tl = 1; for (int i = 1; i <= n; i++){ if (cur<0){ cur = 0; tl = i; } cur += a[i]; if (cur>ans){ ans = cur; r = i; l = tl; } } cout << ans << ‘ ‘ << l << ‘ ‘ << r << endl; return 0; }
标签:int return code i++ 个数 连续 col style pre
原文地址:https://www.cnblogs.com/kang000/p/9125616.html