SWEA 1940

녹색자몽·2021년 8월 6일
0

Algorithm

목록 보기
24/80
post-thumbnail

가랏! RC카!

T = int(input())
 
for tc in range(1, T + 1): 

    distance,velocity = 0, 0
    N = int(input())

    for i in range(N):
        tmp = list(map(int,input().split()))

        if tmp[0] == 1:
            velocity += tmp[1]
        elif tmp[0] == 2:
            velocity = max(0,velocity-tmp[1])

        distance += velocity
    print(f'#{tc} {distance}')
profile
볕 좋은 날 시작하는 개발일기

0개의 댓글

관련 채용 정보