Papyrus在审判你 • 5天前
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int b;
cin >> b;
int result = b;
int ans = b;
for (int i = 1; i < n; i++) {
int t;
cin >> t;
result = max(result + t, t);
ans = max(result, ans);
}
cout << ans << endl;
return 0;
}
评论:
请先登录,才能进行评论