프로그래머스 타겟넘버 [c++] [stack] [level2]


프로그래머스 타겟넘버 [c++] [stack] [level2]

#include #include #include #include #include using namespace std; int res=0; //결과값 저장할 배열 typedef struct { int num; //현재값을 저장할 변수 int cnt; //현재 인덱스를 저장할 변수 }node; void func(int start,vector v, int t) { stacks; s.push({start,0}); //첫번째값 앞에 -,+ 가 있는 경우를 각각 push, 인덱스는 0부터 s.push({start*-1,0}); while(!s.empty()) { int snum = s.top().num; int scnt = s.top().cnt; s.pop(); if(scnt >=v.size()) //인덱스가 ve..


원문링크 : 프로그래머스 타겟넘버 [c++] [stack] [level2]