본문 바로가기

BOJ 1120 - 문자열 https://www.acmicpc.net/problem/1120 BOJ 1120 - 문자열 작성언어: python3a, b = input().split()ans = 51cnt = 0​for i in range(0, len(b) - len(a) + 1): cnt = 0 for j in range(0, len(a)): if a[j] != b[j+i]: cnt += 1 ans = min(cnt, ans)​print(ans)pc 환경에서 코드를 보는 것을 권장합니다.
BOJ 2875 - 대회 or 인턴 https://www.acmicpc.net/problem/2875 BOJ 2875 - 대회 or 인턴 작성언어: Python3xxxxxxxxxxn, m, k = map(int, input().split())​print(int(min(min(n/2, m), (n+m-k)/3)))pc 환경에서 코드를 보는 것을 권장합니다.
BOJ 10610 - 30 https://www.acmicpc.net/problem/10610 BOJ 10610 - 30 작성언어: Python3n = input()number = []ans = ''​for item in n: number.append(item)​number.sort(reverse=True)​for item in number: ans += itemans = int(ans)​if ans % 10 == 0 and ans % 3 == 0: print(ans)else: print(-1)pc 환경에서 코드를 보는 것을 권장합니다.
BOJ 2217 - 로프 https://www.acmicpc.net/problem/2217 BOJ 2217 - 로프 작성언어: Python3n = int(input())ans = 0rope_list = []​for i in range(n): rope_list.append(int(input()))rope_list.sort()​for i in range(0, len(rope_list)): ans = max(ans, rope_list[i]*(n-i))​print(ans)pc 환경에서 코드를 보는 것을 권장합니다.
BOJ 5585 - 거스름돈 BOJ 5585 - 거스름돈 작성언어: Python3change = 1000 - int(input())kindsOfMoney = [500, 100, 50, 10, 5, 1]cnt = 0​while change != 0: for money in kindsOfMoney: if change // money > 0: cnt += change // money change = change % money​print(cnt)pc 환경에서 코드를 보는 것을 권장합니다.
프로그래머스 - 탐욕법(Greedy) - 구명보트 프로그래머스 - 탐욕법(Greedy) - 구명보트 작성언어: Python3def solution(people, limit): answer = 0 people.sort() light = 0 heavy = len(people) - 1 cnt = 0​ while(light
프로그래머스 - 탐욕법(Greedy) - 큰 수 만들기 프로그래머스 - 탐욕법(Greedy) - 큰 수 만들기 작성언어: Python3xxxxxxxxxxdef solution(number, k): answer = '' length = len(number)​ if (len(number)
프로그래머스 - 탐욕법(Greedy) - 조이스틱 프로그래머스 - 탐욕법(Greedy) - 조이스틱 작성언어: Python3def solution(name): answer = 0 idx = 0 base = 'A' * len(name)​ while(True): leftIdx = idx rightIdx = idx​ if(name[idx] != 'A'): if(ord(name[idx]) - ord('A') > 13): answer += 26 - (ord(name[idx]) - ord('A')) else: answer += ord(name[idx]) - ord('A') name = name[0:idx] + 'A' + name[idx+1:] if(name == base): break while(name[leftIdx] == 'A' and name[rightIdx..