python-algorithm
백준 16199 나이 계산하기
무적김두칠
2022. 1. 14. 09:02
1
2
3
4
5
6
7
8
9
10
11
12
|
birthYear,birthMonth,birthDay=map(int,input().split())
currentYear, currentMonth, currentDay = map(int, input().split())
if currentMonth>birthMonth : ageFirst=currentYear-birthYear
elif currentMonth<birthMonth : ageFirst=currentYear-birthYear-1
else :
if currentDay>=birthDay : ageFirst= currentYear-birthYear
else: ageFirst=currentYear-birthYear-1
ageSecond= currentYear-birthYear +1
ageThird=currentYear-birthYear
print(ageFirst)
print(ageSecond)
print(ageThird)
|
cs |
처음 떠올린건 Datetime Lib이용해서 구현할려고 했으나
망할놈의 Korean age 만 나이때문에 그냥 조건문으로 구현했습니다.
반응형