반응형
풀이
- 해당 문제는 순열을 활용하여서
- 단순하게 해결하고자 했으며
- 각 영역에 따른 조건 분기를 거친 후 result 값을 변경하여 해결
from itertools import permutations
li = list(input().split(":"))
result = 0
for i in permutations(li):
x = list(i)
h,m,s = int(x[0]),int(x[1]),int(x[2])
if 0<h<=12 and 0<=m<=59 and 0<=s<=59: result+=1
print(result)
'알고리즘' 카테고리의 다른 글
[백준, 파이썬, 1453번] 피시방 알바 (0) | 2024.01.10 |
---|---|
[백준, 자바, 1440번] 타임 머신 (1) | 2024.01.09 |
[백준, 자바, 1251번] 단어 나누기 (0) | 2024.01.08 |
[백준, 파이썬, 1251번] 단어 나누기 (0) | 2024.01.08 |
[백준, 자바, 1392번] 노래 악보 (1) | 2024.01.08 |