Python/백준 (BOJ)

[BOJ][B2]dates - 3183

ㅋㅋ! 2025. 9. 25. 13:00

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

문제 전문은 링크 참조

문제가공

입력받은 day, month, year 가 유효한 날짜인지 확인하고 출력하자

코드작성

from datetime import date
while True:
    d,m,y = map(int,input().split())
    if d==m==y==0:
        break
    try:
        d = date(y,m,d)
        print('Valid')
    except:
        print('Invalid')

 

'Python > 백준 (BOJ)' 카테고리의 다른 글

[BOJ][B2]Vigenère Cipher Encryption - 3417  (0) 2025.09.27
[BOJ][B2]LUKA - 3234  (0) 2025.09.26
[BOJ][B2]줄임말 만들기 - 3181  (0) 2025.09.24
[BOJ][B2]상근이의 체스판 - 3076  (0) 2025.09.23
[BOJ][B2]수 뒤집기 - 3062  (0) 2025.09.22