본문 바로가기

학습 노트/알고리즘 (Python)

99클럽 - 나이 계산하기

https://www.acmicpc.net/problem/16199

아이디어

(작성중)

풀이

birth_year, birth_month, birth_day = map(int, input().split())
ref_year, ref_month, ref_day = map(int, input().split())

international_age = ref_year - birth_year
if ref_month < birth_month or (ref_month == birth_month and ref_day < birth_day):
    international_age -= 1

korean_age = ref_year - birth_year + 1

yearly_age = ref_year - birth_year

print(international_age)
print(korean_age)
print(yearly_age)