[Python / 프로그래머스 level 2] 기능개발 import math def solution(progresses, speeds): answer = [] progresses = [math.ceil((100-a)/b) for a, b in zip(progresses, speeds)] a = 0 for i in range(len(progresses)): if progresses[a] Language/Python 2021.08.13
[C++ / 백준 18258] 큐 2 #include #include #include using namespace std; int main(void) { cin.tie(0); cin.sync_with_stdio(0); int num, data; queue q; string str; cin >> num; for (int i = 0; i > str; if (str == "push") { cin >> data; q.push(data); } else if (str == "pop") { if (q.size() == 0) std::cout Language/C++ 2021.08.11
[Python / 프로그래머스 level 2] 더 맵게 import heapq def solution(scoville, K): answer = 0 heapq.heapify(scoville) while scoville[0] Language/Python 2021.08.11
[Python / 프로그래머스 level 2] 다음 큰 숫자 def solution(n): a = bin(n).count('1') for i in range(n+1,1000001): if bin(i).count('1') == a: return i Language/Python 2021.08.10
[Python / 프로그래머스 level 2] 카펫 def solution(brown, yellow): s = brown + yellow for longth in range(s,2,-1): if s % longth == 0: length = s // longth if yellow == (longth - 2) * (length - 2): return [longth, length] Language/Python 2021.08.10
[C++ / 백준 10828] 스택 #include #include #include using namespace std; int main(void) { int n; cin >> n; stack st; string str; for (int i = 0; i > str; if (str == "push") { int num; cin >> num; st.push(num); } else if (str == "pop") { if (!st.empty()) { cout Language/C++ 2021.08.09
[Python / 프로그래머스 level 2] 주식가격 from collections import deque def solution(prices): queue = deque(prices) answer = [] while queue: price = queue.popleft() sec = 0 for q in queue: sec += 1 if price > q: break answer.append(sec) return answer Language/Python 2021.08.09
[C++ / 백준 10872] 팩토리얼 #include using namespace std; int facto(int n) { if (n > n; cout Language/C++ 2021.08.05
[Python / 프로그래머스 level 2] 행렬의 곱셈 import numpy as np def solution(A, B): answer = [[]] answer = (np.matrix(A)*np.matrix(B)).tolist() return answer Language/Python 2021.08.05
[C++ / 백준 1427] 소트인사이드 #include #include using namespace std; int main() { string str; cin >> str; sort(str.begin(), str.end(), greater()); cout Language/C++ 2021.08.04