-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path연 월 일 달력
30 lines (28 loc) · 1.1 KB
/
연 월 일 달력
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
T = int(input())
for test_case in range(0, T):
yymmdd = input()
year = yymmdd[0:4]
month = yymmdd[4:6]
day = yymmdd[6:]
#월의 조건 1~12 사이
if(int(month)> 0 and int(month) < 13):
#2는 1~28일 if month in [1,3,5,7,8,10,12]:
if int(month) == 2:
if 0 < int(day) < 29:
print("#" + str(test_case+1) + " " + str(year) + "/" + str(month) + "/" + str(day))
else:
print("#" + str(test_case+1) + " -1")
#3,5,7,8,10,12월은 1~31일
elif int(month) in [1,3,5,7,8,10,12]:
if 0 < int(day) < 32:
print("#" + str(test_case+1) + " " + str(year) + "/" + str(month) + "/" + str(day))
else:
print("#" + str(test_case+1) + " -1")
#4,6,9,11은 1~30일
elif int(month) in [4,6,9,11]:
if 0 < int(day) < 30:
print("#" + str(test_case+1) + " " + str(year) + "/" + str(month) + "/" + str(day))
else:
print("#" + str(test_case+1) + " -1")
else:
print("#" + str(test_case+1) + " -1")