C++3 [프로그래머스] 위장 파이썬 C++ 문제링크 programmers.co.kr/learn/courses/30/lessons/42578 코딩테스트 연습 - 위장 programmers.co.kr Python from collections import defaultdict def solution(clothes): answer = 0 dic=defaultdict(int) for i in clothes: dic[i[1]]+=1 multiple=1 for i in dic: multiple*=dic[i]+1 return multiple-1 아이디어: 경우의 수 세기 문제. 아무것도 안입을 수는 없으므로 옷종류+1을 곱하고 마지막에 1뺌. C++ #include #include #include #include using namespace std; int .. 2021. 5. 3. C++ 코딩테스트 끄적끄적 지속적인 업데이트 예정 1. #include #include using namespace std; int main() { //선언 string str1 = "hello world"; cout 2021. 4. 20. [프로그래머스] 완주하지 못한 선수 (파이썬, C++) 문제링크 programmers.co.kr/learn/courses/30/lessons/42576 코딩테스트 연습 - 완주하지 못한 선수 수많은 마라톤 선수들이 마라톤에 참여하였습니다. 단 한 명의 선수를 제외하고는 모든 선수가 마라톤을 완주하였습니다. 마라톤에 참여한 선수들의 이름이 담긴 배열 participant와 완주한 선수 programmers.co.kr Python from collections import defaultdict def solution(participant,completion): d=defaultdict(int) for p in participant: d[p]+=1 for c in completion: d[c]-=1 if d[c]==0: d.pop(c) return "".join(.. 2021. 4. 20. 이전 1 다음