def split(source, input):
if source[0].isdigit() and source[1].isdigit(): # 10이면
input.append(source[0] + source[1])
input.append(source[2])
if len(source) > 3:
if source[3].isdigit():
input.append("!")
source = source.replace(source[0] + source[1] + source[2], "")
else:
input.append(source[3])
source = source.replace('10' + source[2] + source[3], "")
else:
input.append("!")
else: # 10이 아니면
input.append(source[0])
input.append(source[1])
if len(source) >= 4 and source[1] != 0:
if source[2].isdigit():
input.append("!")
source = source.replace(source[0] + source[1], "")
else:
input.append(source[2])
source = source.replace(source[0] + source[1] + source[2], "")
else: # 결과3 분석
if len(source) < 3:
input.append("!")
else:
input.append(source[2])
return source, input
def solution(dartResult):
first = []
second = []
third = []
dartResult, first = split(dartResult, first)
dartResult, second = split(dartResult, second)
dartResult, third = split(dartResult, third)
print(first,second,third)
print(dartResult, first, second, third)
a = pow(int(first[0]), 1 if first[1] == "S" else 2 if first[1] == "D" else 3) * (-1 if first[2] == "#" else 2 if first[2] == "*" else 1) * (2 if second[2] == "*" else 1)
b = pow(int(second[0]), 1 if second[1] == "S" else 2 if second[1] == "D" else 3) * (-1 if second[2] == "#" else 2 if second[2] == "*" else 1) * (2 if third[2] == "*" else 1)
c = pow(int(third[0]), 1 if third[1] == "S" else 2 if third[1] == "D" else 3) * (-1 if third[2] == "#" else 2 if third[2] == "*" else 1)
answer = a+b+c
print(a,b,c,answer)
return answer
if source[0].isdigit() and source[1].isdigit(): # 10이면
input.append(source[0] + source[1])
input.append(source[2])
if len(source) > 3:
if source[3].isdigit():
input.append("!")
source = source.replace(source[0] + source[1] + source[2], "")
else:
input.append(source[3])
source = source.replace('10' + source[2] + source[3], "")
else:
input.append("!")
else: # 10이 아니면
input.append(source[0])
input.append(source[1])
if len(source) >= 4 and source[1] != 0:
if source[2].isdigit():
input.append("!")
source = source.replace(source[0] + source[1], "")
else:
input.append(source[2])
source = source.replace(source[0] + source[1] + source[2], "")
else: # 결과3 분석
if len(source) < 3:
input.append("!")
else:
input.append(source[2])
return source, input
def solution(dartResult):
first = []
second = []
third = []
dartResult, first = split(dartResult, first)
dartResult, second = split(dartResult, second)
dartResult, third = split(dartResult, third)
print(first,second,third)
print(dartResult, first, second, third)
a = pow(int(first[0]), 1 if first[1] == "S" else 2 if first[1] == "D" else 3) * (-1 if first[2] == "#" else 2 if first[2] == "*" else 1) * (2 if second[2] == "*" else 1)
b = pow(int(second[0]), 1 if second[1] == "S" else 2 if second[1] == "D" else 3) * (-1 if second[2] == "#" else 2 if second[2] == "*" else 1) * (2 if third[2] == "*" else 1)
c = pow(int(third[0]), 1 if third[1] == "S" else 2 if third[1] == "D" else 3) * (-1 if third[2] == "#" else 2 if third[2] == "*" else 1)
answer = a+b+c
print(a,b,c,answer)
return answer
와아아아아앙~~
와아아아아아아아아앙~~~
꺄~~~
갸아아아~~
꺄꺄~~~
우와아아아~~~
우와아아아아앙ㅇ~~~~
우아아아앙~~
우와~~~~~
앙으으ㅏ아아~~~~~~~~~~~~
나도 아까 함 풀어봤는데 정규표현식으로 하면 편하더라. 코드도 짧고
이제 드디어 다른사람들이 푼 답 공개되서 보는데 사람들 미쳤따
그게 1등답인듯 ㄷㄷㄷㄷㄷ
쌉고수 ㅇㅅㅇ
와 이걸 12~13줄로 구현한 사람이 있네 미쳤다미쳤어
아 이거 10을 k로 치환해서 푸는게 제일 정석답인거 같다 ㄷㄷㄷㄷ 이거 경험부족인듯 나도 담부터 이런거 치환해서 풀어야겠다