https://swexpertacademy.com/main/code/problem/problemDetail.do
우선 각 달의 일수를 days라는 list에 저장한다.
5/5와 8/15가 주어졌다고 했을 때
days[5]+days[6]+days[7]+d2-d1를 계산해주면 된다.
T = int(input()) days = [0,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()) total = 1 for i in range(m1,m2): total += days[i] total = total-d1+d2 print('#%d'%test_case,'%d'%total)
'Algorithm > [SWEA] - Python' 카테고리의 다른 글
[SWEA/D3] 16800 : 구구단 걷기 python (0) | 2023.09.09 |
---|---|
[SWEA/D4] 2819 : 격자판의 숫자 이어 붙이기 python (0) | 2023.09.09 |
[SWEA/D3] 13218 : 조별과제 python (0) | 2023.09.08 |
[SWEA/D2] 1288 : 새로운 불면증 치료법 python (0) | 2023.09.07 |
[SWEA/D2] 1284 : 수도 요금 경쟁 python (0) | 2023.09.07 |