Try
[Programmers/C++] 스킬트리 본문
출처
https://programmers.co.kr/learn/courses/30/lessons/49993?language=cpp#
소스
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 31 32 33 34 35 36 | #include <string> #include <vector> using namespace std; int solution(string skill, vector<string> skill_trees) { int answer = 0; int flag = 1; int cnt = 0; int check = 0; for(int i = 0; i < skill_trees.size(); i++){ string com = skill_trees[i]; for(int j = 0; j < com.size(); j++){ int nDelimiter = skill.find(com[j]); if(nDelimiter < 0 || nDelimiter > 30){ continue; } else if(nDelimiter != check){ flag = 0; break; } else{ check++; } } if(flag){ cnt++; } check = 0; flag = 1; } answer = cnt; return answer; } | cs |
'Algorithm > Programmers' 카테고리의 다른 글
[Programmers/C++] 폰켓몬 (0) | 2019.04.04 |
---|---|
[Programmers/Python] 스킬트리 (0) | 2019.03.27 |
[Programmers/Python] 숫자게임 (0) | 2019.03.26 |
[Programmers/C++] 숫자 게임 (0) | 2019.03.26 |
[Programmers/Python] 저울 (0) | 2019.03.24 |
Comments