본문 바로가기
알고리즘/시뮬레이션

2455 지능형 기차

by tryotto 2020. 1. 14.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
 
int main() {
    int cur = 0, maxN = -1;
    for (int i = 0; i < 4; i++) {
        int a, b;
        scanf("%d %d"&a, &b);
 
        cur += (-+ b);
 
        if (maxN < cur)
            maxN = cur;
    }
    printf("%d", maxN);
}
cs

'알고리즘 > 시뮬레이션' 카테고리의 다른 글

1592 영식이와 친구들  (0) 2020.01.15
2979 트럭 주차  (0) 2020.01.15
2164 카드2  (0) 2020.01.15
1547 공  (0) 2020.01.15
2161 카드1  (0) 2020.01.15