본문 바로가기

반응형

분류 전체보기

(133)
백준 11651 "좌표 정렬하기 2" Python import sys n = int(input()) array = [] for _ in range(n): array.append(list(map(int, sys.stdin.readline().rstrip().split()))) array.sort(key= lambda x : x[0]) array.sort(key= lambda x : x[1]) #array.sort(key= lambda x : (x[0], x[1]))로도 가능 for i in array: print(*i)
백준 11650 "좌표 정렬하기" Python import sys n = int(input()) array = [] for _ in range(n): array.append(list(map(int, sys.stdin.readline().rstrip().split()))) array.sort(key= lambda x : x[1]) array.sort(key= lambda x : x[0]) #array.sort(key= lambda x : (x[0], x[1]))로도 가능 for i in array: print(*i)
백준 1427 "소트인사이드" Python import sys temp = sys.stdin.readline().rstrip() array = [] for i in temp: array.append(int(i)) array.sort(reverse=True) for i in array: print(i, end="")
백준 2108 "통계학" Python import sys from typing import Counter n = int(input()) k = [] answer = [] for _ in range(n): k.append(int(sys.stdin.readline())) sortedK = sorted(k) arithmeticMean = sum(k)/n median = sortedK[n//2] r = max(k) - min(k) mode = 0 count = Counter(sortedK).most_common() if len(count) >= 2 and count[0][1] == count[1][1]: mode = count[1][0] else: mode = count[0][0] print(round(arithmeticMean)) p..
백준 2751 "수 정렬하기 2" Python n = int(input()) k = [] for _ in range(n): k.append(int(input())) k = set(k) k = list(k) k.sort() for i in k: print(i)
백준 2750 "수 정렬하기" Python n = int(input()) k = [] for _ in range(n): k.append(int(input())) k = set(k) k = list(k) k.sort() print(*k)
백준 7568 "덩치" Python from collections import deque n = int(input()) array = deque() answer = [] for i in range(n): array.append(list(map(int,input().split()))) for i in range(len(array)): point = 1 man = array.popleft() for i in array: if i[0] > man[0] and i[1] > man[1] : point += 1 answer.append(point) array.append(man) print(*answer)
백준 2447 "별 찍기 - 10" Python def recursive(depth, k, stars): #1. 탈출 if k ==0 : for i in stars: for j in i: print(j, end="") print() return #2. 재귀로직 step = int(k*3) for a in range(0, len(stars), step): for b in range(0, len(stars), step): for i in range(a+k, a+2*k): for j in range(b+k, b+2*k): stars[i][j] = " " recursive(depth+1, k//3, stars) n = int(input()) empty = n//3 stars = [["*"] *n for _ in range(n) ] recursiv..