반응형 전체 글34 #11005_10진법수 B진법 변환 table = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" N, B = map(int, input().split()) answer = "" while N !=0 : answer += table[N%B] N//=B print(answer[::-1]) 2021. 10. 4. #11286_절댓값 힙, #11279_최대 힙 #best import sys import heapq input=sys.stdin.readline heap = [] for _ in range(int(input())): x = int(input()) if x != 0: heapq.heappush(heap, [abs(x),x]) else: print(heapq.heappop(heap)[1] if heap else 0) - 힙에 배열 넣기 #try import sys,heapq heap = [] minus = [] for i in range(int(sys.stdin.readline())): x = int(sys.stdin.readline()) if x == 0: if len(heap) == 0 : print(0) elif len(minus) != 0: H .. 2021. 10. 4. #11650_좌표정렬 arr = [] for _ in range(int(input())): arr.append(list(map(int, input().split()))) arr.sort(key=lambda x:(x[0], x[1])) # x좌표 오름차순 후 y좌표 오름차순 for e in arr : print(str(e[0]) + " " + str(e[1])) 2021. 10. 4. #15649_순열(순서고려), #15650_조합(순서고려x) from itertools import permutations n,m = map(int,input().split()) for i in list((permutations([str(i+1) for i in range(n)],m))) : print(" ".join(i)) from itertools import combinations n,m = map(int,input().split()) for i in list((combinations([str(i+1) for i in range(n)],m))) : print(" ".join(i)) 2021. 10. 4. 이전 1 2 3 4 5 6 7 ··· 9 다음 반응형