Algorithm37 백준 1654번 : 랜선 자르기 링크 : https://www.acmicpc.net/problem/1654 1654번: 랜선 자르기 첫째 줄에는 오영식이 이미 가지고 있는 랜선의 개수 K, 그리고 필요한 랜선의 개수 N이 입력된다. K는 1이상 10,000이하의 정수이고, N은 1이상 1,000,000이하의 정수이다. 그리고 항상 K ≦ N 이다. 그 www.acmicpc.net import sys input = sys.stdin.readline K, N = map(int, input().split()) lan = [int(input()) for _ in range(K)] res = 0 s, e = 1, max(lan) while e-s >= 0: num = 0 mid = (s+e)//2 for i in range(K): num += .. 2022. 2. 12. 백준 20291번 : 파일 정리 링크 : https://www.acmicpc.net/problem/20291 20291번: 파일 정리 친구로부터 노트북을 중고로 산 스브러스는 노트북을 켜자마자 경악할 수밖에 없었다. 바탕화면에 온갖 파일들이 정리도 안 된 채 가득했기 때문이다. 그리고 화면의 구석에서 친구의 메시지를 www.acmicpc.net import sys input = sys.stdin.readline # 시간 줄이기 N = int(input()) dict = {} for i in range(N): x, y = input().strip().split(".") # strip으로 공백 제거 if y in dict: dict[y] += 1 else: dict[y] = 1 for key in sorted(dict.keys()): pr.. 2022. 1. 25. 백준 19948번 : 음유시인 영재 링크 : https://www.acmicpc.net/problem/19948 19948번: 음유시인 영재 감수성이 뛰어난 음유시인 영재는 일상생활 중에 번뜩 시상이 떠오르곤 한다. 하지만 기억력이 좋지 못한 영재는 시상이 떠오르면 그 순간 컴퓨터로 기록해야만 안 까먹는다! 시는 대문자, 소 www.acmicpc.net import sys input = sys.stdin.readline poem = input().strip().split() space = int(input()) alpha = list(map(int, input().split())) result = True if len(poem)-1 > space: result = False else: s = len(poem) for i in range(s.. 2022. 1. 25. 백준 17413번 : 단어 뒤집기 2 링크 : https://www.acmicpc.net/problem/17413 17413번: 단어 뒤집기 2 문자열 S가 주어졌을 때, 이 문자열에서 단어만 뒤집으려고 한다. 먼저, 문자열 S는 아래와과 같은 규칙을 지킨다. 알파벳 소문자('a'-'z'), 숫자('0'-'9'), 공백(' '), 특수 문자('')로만 이루어져 www.acmicpc.net import sys input = sys.stdin.readline S = input().rstrip() inner = False word = '' result = '' for i in S: if inner == False: # 외부 if i == '': 는 나올수 없는 경우 else: word = i + word else: # 내부 if i.. 2022. 1. 25. 이전 1 2 3 4 5 6 7 8 ··· 10 다음