분류 전체보기

Algorithm/Boj

백준 15720 python

b, c ,d = map(int,input().split()) b_price = sorted(list(map(int, input().split())), reverse=True) c_price = sorted(list(map(int, input().split())), reverse=True) d_price = sorted(list(map(int, input().split())), reverse=True) sum = sum(b_price)+sum(c_price)+sum(d_price) sale_sum = 0 Minvalue = min(len(b_price),len(c_price),len(d_price)) for _ in range(Minvalue): sale_sum += (b_price[0]+c_price[..

Algorithm/Boj

백준 19564 python

word = input() alphabet = 'abcdefghijklmnopqrstuvwxyz' count = 1 for i in range(len(word)-1): if alphabet.index(word[i]) < alphabet.index(word[i+1]) : continue else : count += 1 print(count) 현재 글자의 인덱스 값보다 다음 인덱스 값의 알파벳이 뒤에 있으면 입력횟수를 최소화 할 수 있으므로 index()함수를 사용하여 위치를 구하여 비교한다. 또는 alphabet변수 사용없이 아스키코드를 이용해 풀 수도 있다. if ord(word[i]) < ord(word[i+1]) :

Algorithm

이것이 코딩테스트다 - 구현 파트

예제 4-2 문제 정수 n이 입력되면 00시 00분 00초부터 n시 59분 59초까지의 모든 시각 중에서 3이 하나라도 포함되는 모든 경우의 수를 구하는 프로그램을 작성하시오. 입력조건 첫째 줄에 정수 n이 입력된다. (0

Algorithm

이것이 코딩테스트다 - 구현 파트

예제 4-1 상하좌우 입력조건 첫째 줄에 공간의 크기를 나타내는 n이 주어진다. (1