蒙自市蒙自一中马晨烨 • 1年前
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, ans, maxn = -0x3f3f3f3f;
int num[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &num[i]);
ans += -num[i];
if (ans >= maxn)
maxn = ans;
}
printf("%d", maxn);
return 0;
}
//哈哈哈interesting:)
评论:
请先登录,才能进行评论