# 1. 이렇게 했을 때 틀린 점 : set 는 순서를 가지지 않아서 lst_set[0]은 존재 X
lst = input().split()
lst.sort(reverse= True)
lst_set = set(lst)
if len(lst_set) == 1:
print(10000+int(lst_set[0])*1000)
elif len(lst_set) ==2:
print(1000+int(lst_set[0])*100)
else:
print(int(lst_set[0])*100)
# 2. 이렇게 했을 때 틀렸던 점 : lst == 2 일 떄 같은 애가 출력되는게 아니라 큰 애가 출력된거!
lst = input().split()
lst_set = set(lst)
lst = list(lst_set)
lst.sort(reverse= True)
if len(lst) == 1:
print(10000+int(lst[0])*1000)
elif len(lst) ==2:
print(1000+int(lst[0])*100)
else:
print(int(lst[0])*100)
lst = input().split()
lst_set = set(lst)
lst = list(lst_set)
lst.sort(reverse=True)
if len(lst) == 1:
print(10000+int(lst[0])*1000)
elif len(lst) ==2:
print(1000+int(lst[0])*100)
else:
print(int(lst[0])*100)
대충 이렇게 풀었는데 정 모르겠다.
한숨 자고 내일 풀어보면 답이 나오려나..
대충 생각한건 6~1까지 3개인거로 조건3잡고 6~1 2개인거로 조건잡고 6~1 1개인거로 조건 잡으면 복잡해도 로직상 문제는 없는데
그렇게 하면 코드가 너무 복잡하니까 개수별로 뭔가 분류할 방법이 있다면 좋을 것 같은데 내일 생각해봐야겠음
'TIL > [파이썬] 문제 풀이' 카테고리의 다른 글
TIL (22.03.16) (0) | 2022.03.17 |
---|---|
TIL 1 (22.03.14) (0) | 2022.03.15 |