Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Lv.1/Lv.1 크레인 인형뽑기 게임.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <string>
#include <vector>

using namespace std;

int solution(vector<vector<int>> board, vector<int> moves) {
int answer = 0;

vector<int> basket;

for (int i = 0; i < moves.size(); i++) {
int location = moves[i] - 1;

for (int j = 0; j < board.size(); j++) {
if (board[j][location] == 0) continue;

if (!basket.empty() && board[j][location] == basket.back()) {
basket.pop_back();
answer += 2;
}
else {
basket.push_back(board[j][location]);
}

board[j][location] = 0;
break;
}
}

return answer;
}
21 changes: 21 additions & 0 deletions Lv.2/Lv.2 의상.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <string>
#include <vector>
#include <unordered_map>

using namespace std;

int solution(vector<vector<string>> clothes) {
int answer = 1;

unordered_map<string, int> map;
for (auto elem : clothes) {
map[elem[1]] += 1;
}

for (auto m : map) {
answer *= (m.second + 1);
}
answer--;

return answer;
}