Algorithm/noj.am

[Python] 백준 2875번 - 대회 or 인턴

SweetDev 2021. 1. 24. 05:42
# 2875번 대회 or 인턴
import sys

N, M, K = map(int, sys.stdin.readline().split())
# K를 구하는 과정
while K > 0:
    if N // 2 > M:
        N = N - 2
        K = K - 2
    elif N // 2 < M:
        M = M - 1
        K = K - 1
    else:
        N = N - 2
        M = M - 1
        K = K - 3
if min(N // 2, M) > 0:
    print(min(N // 2, M))
else:
    print(0)