照顾新手(帽子戏法)

照顾新手(帽子戏法)

Papyrus在审判你 · 发布于 2025-05-08 · 浏览 350 回复 0
#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;
}

全部回复 共 0 条

还没有人回复。往下写第一条。

发表回复