Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 표창던지기
- visualstudio2022
- 이득우언리얼
- python
- 공부
- 화살표 메서드
- 유니티
- 3차원배열
- 다중상속
- rendermonkey
- 게임만들기
- swipe
- IMGUI
- 이득우
- c++class
- 그림자 효과
- uidesign
- 화살피하기
- 화살표 함수
- 가변배열
- 배열문제
- 파이썬
- 비주얼스튜디오
- C++
- premake5
- 셰이더
- 렌더몽키
- Unity
- c#
- 언리얼
Archives
- Today
- Total
신입 개발자 공부 과정
프로그래머스 의상 C++ 본문

#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
int solution(vector<vector<string>> clothes)
{
int answer{1};
unordered_map<string, int> style;
for (auto type : clothes)//type은 vecotr[x][]
{
style[type[1]]++;//clothes 이중 벡터에 들어있는2번쨰 인자 곧 type을 맵에 추가해준다.
}
for (auto a : style)//a는 <stirng,int>
{
answer *= a.second+1;// 해당 부위를 입는 경우의 수 + 안입는 경우의 수
}
return answer-1;//아예 안입는 경우의 수
}
최소 1가지는 입어야 되기에 아무것도 안입는 경우의 수(1개)를 뺏다.
'C++ > 공부' 카테고리의 다른 글
QMainWindow: Qt의 메인 창 관리 클래스 (0) | 2024.11.27 |
---|---|
C++ 처음부터 다시 공부하기 (진행 중) (1) | 2024.04.15 |
[프로그래머스] 완주하지 못한 선수 - Hash (1) | 2023.12.01 |
프로그래머스 0 떼기 (1) | 2023.11.30 |
프로그래머스 하샤드 수 C++ (0) | 2023.11.07 |