haju__log

[python][SWEA][D2] 1948. 날짜 계산기 본문

SWEA

[python][SWEA][D2] 1948. 날짜 계산기

haju 2023. 5. 12. 13:41

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=2&problemLevel=3&contestProbId=AV5PnnU6AOsDFAUq&categoryId=AV5PnnU6AOsDFAUq&categoryType=CODE&problemTitle=&orderBy=PASS_RATE&selectCodeLang=PYTHON&select-1=3&pageSize=10&pageIndex=4 

 

SW Expert Academy

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

swexpertacademy.com

 

T=int(input())
days=[31,28,31,30,31,30,31,31,30,31,30,31]
for test_case in range(1,T+1):
    m1,d1,m2,d2 = map(int,input().split())
    result=0
    hap1=0
    hap2=0
    for i in range(m1-1):
        hap1+=days[i]
    hap1+=d1
    for i in range(m2-1):
        hap2+=days[i]
    hap2+=d2
    result=hap2-hap1+1
    print("#%d %d" %(test_case,result))