본문 바로가기

백준138

[2490] 웇놀이 #includeusing namespace std;int main(){for (int i = 0; i > a >> b >> c >> d;sum = a + b + c + d;switch (sum){case 0:cout 2018. 8. 9.
[2293] 동전 1 #include #define MAX 10001using namespace std;int dp[MAX] = { 0 }, arr[101];int main(){int n, k, i, j;cin >> n >> k;dp[0] = 1;for (i = 1; i > arr[i];for (i = 1; i 2018. 8. 3.
[1463] 1로 만들기 #include #define MAX 1000001using namespace std;int min(int a, int b);int dp[MAX];int main(){int testcase, i;cin >> testcase;dp[0] = dp[1] = 0;for (i = 2; i 2018. 8. 3.
[2579] 계단 오르기 #include #define MAX 301using namespace std;int max(int a, int b);int main(){int testcase, i;int dp[MAX], arr[MAX];cin >> testcase;for (i = 0; i > arr[i];dp[0] = arr[0];dp[1] = max(arr[0] + arr[1], arr[1]);dp[2] = max(arr[0], arr[1]) + arr[2];for (i = 3; i 2018. 8. 3.
[1932] 정수 삼각형 #include #define MAX 500using namespace std;int max(int a, int b);int main(){int testcase, i, j, sum;int dp[MAX][MAX];cin >> testcase;for (i = 0; i dp[i][j];}for (i = 1; i 2018. 8. 3.
[1149] RGB거리 #include #define MAX 1000using namespace std;int min(int a, int b);int main(){int testcase, i, j;int arr[MAX][3], dp[MAX][3];cin >> testcase;for (i = 0; i arr[i][j];}dp[0][0] = arr[0][0];dp[0][1] = arr[0][1];dp[0][2] = arr[0][2];for (i = 1; i 2018. 8. 3.
[10872] 팩토리얼 #include using namespace std;int iterative_factorial(int n);int main(){int n;cin >> n ;cout 2018. 7. 23.
[11051] 이항 계수 2 #include using namespace std;#define MAX 1001int bin_coef_DP(int n, int k);int C[MAX][MAX];int main(){int n, k;cin >> n >> k;cout 2018. 7. 23.
[11050] 이항 계수 1 #include using namespace std;int bin_coef_DC(int n, int k);int main(){int n, k;cin >> n >> k;cout 2018. 7. 23.
[1003] 피보나치 함수 #include #define MAX 40using namespace std;int memo_fib(int n);int main(){int n, testcase;cin >> testcase;for (int i = 0; i > n;if (n == 0)cout 2018. 7. 23.
[2749] 피보나치 수 3 #include using namespace std;int iterative_fib(long long n);int fib[1500000];int main(){long long n;cin >> n;cout 2018. 7. 23.
[2748] 피보나치 수 2 #include #define MAX 90using namespace std;long iterative_fib(int n);int main(){int n;cin >> n;cout 2018. 7. 23.
[2747] 피보나치 수 #include #define MAX 45using namespace std;int iterative_fib(int n);int main(){int n;cin >> n;cout 2018. 7. 23.
[1021] 회전하는 큐 #include #include using namespace std;int main(){deque dq;deque::iterator iter;int n, m, i, cnt = 0;cin >> n >> m;for (i = 1; i num;int index = 1;for (iter = dq.begin(); iter 2018. 7. 22.
[10866] 덱 #include #include #include using namespace std;int main(){deque dq;int i, num, testcase;string str;cin >> testcase;for (i = 0; i > str;if (str == "push_front"){cin >> num;dq.push_front(num);}else if (str == "push_back"){cin >> num;dq.push_back(num);}else if (str == "pop_front"){if (!dq.empty()){cout 2018. 7. 22.
[1158], [11866] 조세퍼스 문제 #include #include #include using namespace std;void Josephus(int n, int m);int main(){int n, m;cin >> n >> m;Josephus(n, m);return 0;}void Josephus(int n, int m){queue q;int i;for (i = 1; i 2018. 7. 22.
[1966] 프린터 큐 #include #include using namespace std;int main(){int i, testcase;cin >> testcase;for (i = 0; i > n >> m;for (int j = 0; j > a;q.push({ j, a });pq.push(a);}while (!q.empty()){int index = q.front().first;int val = q.front().second;q.pop();if (pq.top() == val){pq.pop();cnt++;if (index == m){cout 2018. 7. 22.
[10845] 큐 #include #include #include using namespace std;int main(){queue q;int i, testcase;string str;cin >> testcase;for (i = 0; i > str;if (str == "push"){int num;cin >> num;q.push(num);}else if (str == "pop"){if (!q.empty()){cout 2018. 7. 22.
[2504] 괄호의 값 #include #include #include using namespace std;int checkVPS(string str);int main(){string str;cin >> str;cout 2018. 7. 22.
[9012] 괄호 #include #include #include using namespace std;bool checkVPS(string str);int main(){string str;int testcase;cin >> testcase;for (int i = 0; i > str;if (checkVPS(str))cout 2018. 7. 22.