제출 #3161

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

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