SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
단순 구현문제
며칠 차이나는지 계산하는건데
해당 월에 일수를 리스트에 넣어서 처리하면 수월함
t = int(input())
for tc in range(1,t+1):
year = [0,31,28,31,30,31,30,31,31,30,31,30,31]
nowM, nowD, nextM, nextD = list(map(int,input().split()))
result = 0
if nowM != nextM:
a = year[nowM:nextM]
result += sum(a)
result-= nowD-1
result+= nextD
print(f"#{tc} {result}")
'Algorithm > swea' 카테고리의 다른 글
[파이썬]swea 1946: 간단한 압축 풀기 (0) | 2023.02.14 |
---|---|
[파이썬]swea 1959: 두 개의 숫자열 (0) | 2023.02.11 |
[파이썬]swea 1961: 숫자 배열 회전 (0) | 2023.02.08 |
[파이썬]swea 1970: 쉬운 거스름돈 (0) | 2023.02.05 |
[파이썬]swea 1976: 시각 덧셈 (1) | 2023.02.04 |
댓글