알고리즘 90

[python/14888]연산자 끼워넣기

https://www.acmicpc.net/problem/14888 14888번: 연산자 끼워넣기 첫째 줄에 수의 개수 N(2 ≤ N ≤ 11)가 주어진다. 둘째 줄에는 A1, A2, ..., AN이 주어진다. (1 ≤ Ai ≤ 100) 셋째 줄에는 합이 N-1인 4개의 정수가 주어지는데, 차례대로 덧셈(+)의 개수, 뺄셈(-)의 개수, 곱셈(×)의 개수, 나눗셈(÷)의 개수이다. www.acmicpc.net 더보기 내 코드 import sys def Insert_Operator(now, level): if level == N: global min_n, max_n max_n = max(now, max_n) min_n = min(now, min_n) return # 더하기 if oper[0] > 0: op..

알고리즘/백준 2020.03.28

[python]Find the Difference in Age between Oldest and Youngest Family Members

https://www.codewars.com/kata/5720a1cb65a504fdff0003e2/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com (가장 나이가 적은 수, 가장 나이가 많은 수, 둘의 차이)를 출력하는 문제이다. 더보기 내 코드 # My Code def difference_in_ages(ages): youngest_age = min(ages) oldest_age = max(ages) return..

[python]All Star Code Challenge#18

https://www.codewars.com/kata/5865918c6b569962950002a1/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 문자열에서 지정한 문자의 개수를 출력하는 문제이다. 더보기 내 코드 count를 이용하면 쉽게 풀 수 있는 문제이다. # My Code def str_count(strng, letter): return strng.count(letter) if __name__=='__..

[python]Will you make it?

https://www.codewars.com/kata/5861d28f124b35723e00005e/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 문제 해석(구글 번역) 집에서 멀리 떨어진 친구들과 캠핑을 했지만 돌아갈 시간이 되면 연료가 떨어지고 가장 가까운 펌프가 50 마일 떨어져 있다는 것을 알게 됩니다! 평균적으로 자동차는 갤런 당 약 25 마일로 운행됩니다. 남은 갤런이 2 개 있습니다. 이러한 요소를..

[python/2446]별 찍기 - 9

https://www.acmicpc.net/problem/2446 2446번: 별 찍기 - 9 첫째 줄부터 2×N-1번째 줄까지 차례대로 별을 출력한다. www.acmicpc.net 더보기 내 코드 어려웠던 점을 찾아보자면, 답에서는 '*'의 왼쪽에만 스페이스가 들어가는데 오른쪽에도 넣어서 헤맸었다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 def star_9(n): tmp = 2*n-1 space = 0 for i in range(1, 2*n): print(' ' * space + '*' * tmp) if i

알고리즘/백준 2020.03.21

[python]Removing Elements

https://www.codewars.com/kata/5769b3802ae6f8e4890009d2/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 인덱스 짝수 번호인 것 지우는 문제이다. 더보기 내 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 # My Code def remove_every_other(my_list): answer = [] for i in range(len(m..

728x90