public void Solve() { int N = NextInt(); var list = new Li(); N.REP(i => list.Add(NextInt())); new ti3(0, N - 1, 1).FOR(i => { if (list[i] % 2 != 1) { return; } if (list[i + 1] <= 0) { return; } list[i]++; list[i + 1]--; }); list.Select(x => (long)x / 2L).Sum().WL(); }
public void Solve() { int N = NextInt(); var A = new Li(); N.REP(i => A.Add(NextInt())); for (int i = 0; i < N - 1; i++) { if (A[i] % 2 == 0) { continue; } if (A[i + 1] <= 0) { continue; } A[i]++; A[i + 1]--; } A.Select(x => (long)x / 2).Sum().WL(); return; }