
# Process
# 1. Input answers
# 2. Make math throwers answers
# 3. Compare answers and math throwers' answers
# 4. Get people who got highest score
# 5. Return result
def solution(answers):
result = []
# 2.
math_thrower_1 = []
math_thrower_2 = []
math_thrower_3 = []
exam_problems = len(answers)
for i in range(1, exam_problems+1):
remainder_of_5 = i % 5
remainder_of_8 = i % 8
remainder_of_10 = i % 10
if remainder_of_5 == 0: math_thrower_1.append(5)
else: math_thrower_1.append(remainder_of_5)
if remainder_of_8 == 1 or remainder_of_8 == 3 or remainder_of_8 == 5 or remainder_of_8 == 7 : math_thrower_2.append(2)
elif remainder_of_8 == 2 : math_thrower_2.append(1)
elif remainder_of_8 == 4 : math_thrower_2.append(3)
elif remainder_of_8 == 6 : math_thrower_2.append(4)
elif remainder_of_8 == 0 : math_thrower_2.append(5)
if remainder_of_10 < 1 : math_thrower_3.append(5)
elif remainder_of_10 < 3 : math_thrower_3.append(3)
elif remainder_of_10 < 5 : math_thrower_3.append(1)
elif remainder_of_10 < 7 : math_thrower_3.append(2)
elif remainder_of_10 < 9 : math_thrower_3.append(4)
elif remainder_of_10 < 11 : math_thrower_3.append(5)
# 3.
correct_counts = [0,0,0]
for i in range(len(answers)):
if answers[i] == math_thrower_1[i] : correct_counts[0] += 1
if answers[i] == math_thrower_2[i] : correct_counts[1] += 1
if answers[i] == math_thrower_3[i] : correct_counts[2] += 1
# 4.
highest_score = max(correct_counts)
for i in range(len(correct_counts)):
if highest_score == correct_counts[i]:
result.append(i+1)
# 5.
return result
별로임
탐욕법 02 - 조이스틱, 프로그래머스, 알고리즘, Programmers, Stack, Queue, Hash, 코딩테스트, Algorithm, 풀
// ASCII 65~ 90 (A~ Z) // Process #2 (greedy) // 1. Input name // 2. Make list or Map using Index and DiffCount of diff things // 3. Iterate while all list is remove..
itdar.tistory.com
2020.10.07 - [Computer/General] - 핸드폰 용량 정리, 최적화, 아이폰/안드로이드/갤럭시/픽셀/엘지/폴더
핸드폰 용량 정리, 최적화, 아이폰/안드로이드/갤럭시/픽셀/엘지/폴더
구글 픽셀3 폰 쓴지 이제 2년? 3년? 정도 됨 64gb 핸드폰인데, 얼마전부터 계속 90% 95% 거의 남은 용량이 없는 것. 사진 때문인가 다 구글클라우드 백업하고 지워도 비슷함. 이런저런 파일들을 지우
itdar.tistory.com
개발자 선배들에게서 배운 것들. Things I Learnt from a Senior Software Engineer. 코딩 잘하는 방법, how to cod
itdar.tistory.com