제출 #3160

#제출 시각아이디문제언어결과실행 시간메모리
3160kipa00지능형 기차 2 (KOI11_train2)C++98
12.80 / 16
0 ms1088 KiB
#include <cstdio>

int main() {
    int i, n = 0, max = -1;
    bool nowplus = true;
    scanf("%d", &i);
    do {
        scanf("%d", &i);
        if (nowplus) {
            n += i;
        } else {
            n -= i;
        }
        if (max < n) {
            max = n;
        }
        nowplus = !nowplus;
    } while (n);
    printf("%d\n", max);
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...