DEV/그냥 알고리즘공부

    C++ 백준 9095

    과거에 푼 c++ 소스... #include #include /* 정수 4를 1, 2, 3의 조합으로 나타내는 방법은 총 7가지가 있다. 1+1+1+1 1+1+2 1+2+1 2+1+1 2+2 1+3 3+1 정수 n이 주어졌을 때, n을 1,2,3의 합으로 나타내는 방법의 수를 구하는 프로그램을 작성하시오. */ int N; int T; void DFS(int k); int count; int main() { scanf("%d",&T); int *arr = new int [T]; for(int i=0; i

    프로그래머스 코딩테스트 연습스택/큐 기능개발 C++/JAVA

    프로그래머스 코딩테스트 연습스택/큐 기능개발 C++/JAVA

    18 년의 나 // 18년의 나.. C++ #include #include using namespace std; vector solution(vector progresses, vector speeds) { vector answer; int N= progresses.size(); bool publish[10000]={false}; bool flag= true; while(flag) { int pubNum=0; for(int i=0;i=100){ if(i==0||publish[i-1]) { // 첫 또는 이전 원소가 출시되었을 때 pubNum++; publish[i]=true; } } } } if(pubNum>0) answer.push_back(pubNum); if(publish[N-1]) // the en..