Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Tags
more
Archives
Today
Total
관리 메뉴

이것저것

python swea 2056 연월일 달력 본문

Language/Python

python swea 2056 연월일 달력

olivia-com 2020. 11. 25. 00:45

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5QLkdKAz4DFAUq&categoryId=AV5QLkdKAz4DFAUq&categoryType=CODE

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

list1 = [1,3,5,7,8,10,12]
list2 = [4, 6, 9, 11]

number = int(input())
year = number // 10000
month = (number % 10000) // 100
day = number % 100

if month in list1:
    if 1<= day <= 31:
        print("%04d/%02d/%02d" %(year, month, day))
    else:
        print(-1)
elif month in list2:
    if 1<= day <= 30:
        print("%04d/%02d/%02d" %(year, month, day))
    else:
        print(-1)
elif month == 2:
    if 1<= day <= 28:
        print("%04d/%02d/%02d" %(year, month, day))
    else:
        print(-1)
else:
    print(-1)