목록baekjoon (60)
컴공생의 다이어리
백준 5585번 : 거스름돈 (문제 바로가기) 내 코드 n = 1000 - int(input()) coins = (500,100,50,10,5,1) count = 0 for coin in coins: count += n//coin n%=coin print(count)
백준 11399번 : ATM (문제 바로가기) 내 코드 import sys n = int(input()) L = list(map(int,sys.stdin.readline().strip().split())) L.sort() L_time = [sum(L[:x]) for x in range(1,n+1)] print(sum(L_time))
백준 5635번 : 생일 (문제 바로가기) 내 코드 import sys n = int(input()) info = [] for _ in range(n): info.append(list(map(str,sys.stdin.readline().strip().split()))) info.sort(key = lambda x : (int(x[-1]),int(x[-2]),int(x[-3]))) print(info[-1][0]) print(info[0][0])
백준 11650번 : 좌표 정렬하기 (문제 바로가기) 내 코드 import sys n = int(input()) x_y = [] for _ in range(n): x_y.append(list(map(int,sys.stdin.readline().strip().split()))) x_y.sort(key = lambda x : (x[0],x[1])) for x, y in x_y: print(x, y)
백준 1181번 : 단어 정렬 (문제 바로가기) 내 코드 import sys n = int(input()) word_list = [] for _ in range(n): word_list.append(sys.stdin.readline().strip()) word_list = list(set(word_list)) # 중복 제거 word_list.sort(key = lambda x: (len(x), x)) # 정렬 result = "\n".join(word_list) print(result)
백준 1011번 : Fly me to the Alpha Centauri (문제 바로가기) 내 코드 import sys t=int(sys.stdin.readline()) for _ in range(t): x,y = map(int,sys.stdin.readline().split()) distance = y-x count = 1 while True: if count ** 2
백준 2869번 : 달팽이는 올라가고 싶다 (문제 바로가기) 내 코드 a,b,v=map(int,input().split()) if (v-b)%(a-b)==0: print((v-b)//(a-b)) else: print((v-b)//(a-b)+1)
백준 2292번 : 벌집 (문제 바로가기) 내 코드 x=int(input()) line=1 while True: if x
백준 2292번 : 벌집 (문제 바로가기) 내 코드 n=int(input()) count=1 num=1 while True: if num>=n: break num+=6*count count+=1 print(count)
백준 1712번 : 손익분기점 (문제 바로가기) 손익분기점이란? 최초로 총 수입이 총 비용보다 많아져 이익이 발생하는 지점 이 문제에서 출력 결과는 손익분기점이 있을 경우와 없을 경우로 나누어진다. 손익분기점이 없을 경우는 B라는 가변비용보다 C라는 상품 가격이 클 때이다. 간단하게 생각해보면 생산하는데 드는 비용이 판매하는 가격보다 크면 그것은 손실이기 때문에 손익분기점이 없다. 내 코드 a,b,c = map(int,input().split()) if b>=c: print(-1) else: print(int(a/(c-b))+1)