文章
16
粉丝
134
获赞
0
访问
11.5k
#include<bits/stdc++.h>
using namespace std;
long long dp[1000010];
long long a[1000010];
long long maxx;
long long s = 0, d = 0;
long long temp_start = 0;
int main() {
long long n;
while(cin >> n) {
if(n == 0)
break;
int sum = 0;
for(long long i = 0; i < n; i++) {
cin >> a[i];
if(a[i] < 0) {
sum++;
}
}
if(n == 1) {
cout << a[0] << " " << a[0] << " " << a[0] << endl;
} else if(sum == n) {
cout << "0 " << a[0] << " " << a[n - 1] << endl;
} else {
dp[0] = a[0];
maxx = dp[0]; //最小的情况非空,那么就是某一个值
s = 1;
d = 1;
for(long long i = 1; i < n; i++) {
if(dp[i - 1] + a[i] < a[i]) {
dp[i] = a[i];
temp_sta...
登录后发布评论
暂无评论,来抢沙发