/*
贪心:暴力贪心水水
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std; const int MAXN = 1e2 + ;
const int INF = 0x3f3f3f3f;
int a[MAXN]; int main(void) //Codeforces Round #191 (Div. 2) A. Flipping Game
{
int n; scanf ("%d", &n);
int sum = ;
for (int i=; i<=n; ++i) scanf ("%d", &a[i]), sum += a[i]; int ans = ;
for (int i=; i<=n; ++i)
{
for (int j=; j<=n-i+; ++j)
{
int pre = ; int now = ;
for (int k=j; k<=j+i-; ++k)
{
pre += a[k]; now += - a[k];
}
ans = max (ans, sum - pre + now);
}
} printf ("%d\n", ans); return ;
}
相关文章
- Codeforces Round #257 (Div. 2) A. Jzzhu and Children(简单题)
- Codeforces Round #520 (Div. 2) A. A Prank 好题
- Codeforces Round #455 (Div. 2) A. Generate Login【贪心】
- 【CodeForces】841D. Leha and another game about graph(Codeforces Round #429 (Div. 2))
- Codeforces Round #350 (Div. 2) B. Game of Robots __ interesting
- Codeforces Round #429 (Div. 2) - D Leha and another game about graph
- Codeforces Round #429 (Div. 2) D. Leha and another game about graph
- codeforces水题100道 第十二题 Codeforces Beta Round #91 (Div. 2 Only) A. Lucky Division (brute force)
- Codeforces Round #604 (Div. 2) A. Beautiful String
- 贪心 Codeforces Round #303 (Div. 2) B. Equidistant String