본문 바로가기

python26

백준 2022번 : 사다리 링크 : https://www.acmicpc.net/problem/2022 2022번: 사다리 첫째 줄에 차례대로 x, y, c에 해당하는 양의 실수 세 개가 입력된다. 수는 소수점 여섯째 자리까지 주어질 수 있으며, 3,000,000,000보다 작거나 같다. www.acmicpc.net import sys input = sys.stdin.readline import math def get_height(x, y, w): h1 = math.sqrt(x**2-w**2) h2 = math.sqrt(y**2-w**2) h = h1*h2/(h1+h2) return h x, y, c = map(float, input().split()) w_s = 0 w_e = min(x, y) dif = 1 res_w = 0 wh.. 2022. 2. 12.
백준 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.