WookjeBlog
    • 블로그
    • 소개
    • 태그
    • 수업/강의
    • 라이브러리

    Wookje blog

    알고리즘 블로그였던 것

    Featured Posts
    • [BOJ] 15991 : 1, 2, 3 더하기 6

      15991 : 1, 2, 3 더하기 6 풀이 둠칫타칫 코드 #include <cstdio> const int m = 1e9+9; int n, t, d[55555]={0,1,1,2,4}; int main() { for (int i = 5; i <= 55555; i++) { d[i] = ((long long)d[i-1]+d[i-2]+d[i-3]) % m; } for (scanf("%d", &t); t--;) { scanf("%d", &n); printf("%d\n", (d[n/2+1] + d[n/2]) % m); } return 0; } 아무말 백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge, C, C++, 씨, 씨쁠쁠, JAVA, algorithm, 자바, 알고리즘,...

      boj dynamic-programming

      wookje.kwon's profile image

      wookje.kwon

      2018-09-09 23:00

    • [BOJ] 15990 : 1, 2, 3 더하기 5

      15990 : 1, 2, 3 더하기 5 풀이 계단오르기 아니면 RGB거리 문제랑 비슷하게 풀면 된다 코드 #include <cstdio> const int m = 1e9+9; int n, t, d[3][100001]; int main() { d[0][1] = d[1][2] = d[0][3] = d[1][3] = d[2][3] = 1; for (int i = 4; i <= 100000; i++) { d[0][i] = (d[1][i-1]+d[2][i-1])%m; d[1][i] = (d[0][i-2]+d[2][i-2])%m; d[2][i] = (d[0][i-3]+d[1][i-3])%m; } for (scanf("%d", &t); t--;) { scanf("%d", &n); printf("%lld\n", ((long long)d[0][n]+d[1][n]+d[2][n])%m); } return 0; }...

      boj dynamic-programming

      wookje.kwon's profile image

      wookje.kwon

      2018-09-07 16:34

    • [BOJ] 15989 : 1, 2, 3 더하기 4

      15989 : 1, 2, 3 더하기 4 풀이 계단오르기 문제랑 비슷하게 풀면 된다 중복되는 경우를 배제해야 하므로 2칸 오르는 경우의 수와 3칸 오르는 경우의 수를 따로 구해주자 답은 두 값을 합친 거에 1로만 채우는 경우의 수 1을 더해주면 된다. 코드 #include <cstdio> int n, t, d[2][10001]; int main() { d[0][2] = 1; for (int i = 3; i <= 10000; i++) { d[0][i] = d[0][i-2]+1; d[1][i] = d[0][i-3]+d[1][i-3]+1; } for (scanf("%d", &t); t--;) { scanf("%d",...

      boj dynamic-programming

      wookje.kwon's profile image

      wookje.kwon

      2018-09-07 16:22

    • [BOJ] 15988 : 1, 2, 3 더하기 3

      15988 : 1, 2, 3 더하기 3 풀이 간다~~~~~~~~` 코드 #include <cstdio> int n, t, d[1000001]={0,1,2,4}; int main() { for (int i = 4; i <= 1e6; i++) { d[i] = ((long long)d[i-1]+d[i-2]+d[i-3]) % (int)(1e9+9); } for (scanf("%d", &t); t--;) { scanf("%d", &n); printf("%d\n", d[n]); } return 0; } 아무말 백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge, C, C++, 씨, 씨쁠쁠, JAVA, algorithm, 자바, 알고리즘, 자료구조, 문제, 문제 풀이, 풀이

      boj dynamic-programming

      wookje.kwon's profile image

      wookje.kwon

      2018-09-07 16:22

    • [BOJ] 4801 : Nine

      4801 : Nine 풀이 짜라는대로 짜면 된다 약간 영어 독해 문제 코드 #include <cstdio> #include <algorithm> using namespace std; inline int calc(int n) { int r = 0; while (n) { r += n%10==9; n /= 10; } return r; } int main() { int h, m; while (scanf("%d:%d", &h, &m) && (h || m)) { int a = h*60+m; int rcnt = -1, rerr = 1e9, ri = -1, rj = -1; for (int...

      boj acm-icpc naive

      wookje.kwon's profile image

      wookje.kwon

      2018-09-07 16:21

    • [BOJ] 3747 : 완벽한 선거!

      3747 : 완벽한 선거! 풀이 MAKE WOOKJE GREAT AGAIN!! 코드 #include <cstdio> #include <stack> #include <vector> #include <algorithm> using namespace std; typedef vector<int> vi; const int n_ = 1000*2+2; int n, m, cnt, scc[n_], chk[n_], ans[n_]; vi gph[n_]; vector<vi> res; stack<int> stk; int getSCC(int now) { chk[now] = ++cnt; int ret = chk[now]; stk.push(now); for (int nxt : gph[now]) { if (!chk[nxt]) ret = min(ret, getSCC(nxt)); else if (!scc[nxt]) ret = min(ret, chk[nxt]); } if...

      boj acm-icpc 2-sat

      wookje.kwon's profile image

      wookje.kwon

      2018-09-07 16:17

    • [BOJ] 15969 : 행복

      15969 : 행복 풀이 돌려돌려~ 돌림판~ 코드 #include <cstdio> int n, x, mn = 1e9, mx = -1e9; int main() { scanf("%d", &n); while (n--) { scanf("%d", &x); if (mn > x) mn = x; if (mx < x) mx = x; } printf("%d", mx - mn); return 0; } 아무말 백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge, C, C++, 씨, 씨쁠쁠, JAVA, algorithm, 자바, 알고리즘, 자료구조, 문제, 문제 풀이, 풀이

      boj koi naive

      wookje.kwon's profile image

      wookje.kwon

      2018-09-06 17:42

    • [BOJ] 16043 : Missing Gnomes

      16043 : Missing Gnomes 풀이 주어지지 않은 숫자 중 작은 숫자부터 그리디하게 채워넣으면 된다. 코드 #include <cstdio> #include <vector> #include <algorithm> using namespace std; int n, m, c[100001]; vector<int> a, b, r; int main() { scanf("%d %d", &n, &m); a.resize(m+1); for (int i = 0, x; i < m; i++) { scanf("%d", &a[i]); c[a[i]] = 1; } for (int i = 1; i <= n; i++) { if (!c[i]) b.push_back(i); } int i = 0,...

      boj naive greedy

      wookje.kwon's profile image

      wookje.kwon

      2018-09-06 16:34

    • [BOJ] 11581 : 구호물자

      11581 : 구호물자 풀이 공.강.시.러 코드 #include <cstdio> #include <cstdlib> #include <vector> using namespace std; int n, m, chk[102]; vector<int> gph[102]; void dfs(int now) { if (chk[now] == 1) { puts("CYCLE"); exit(0); } chk[now] = 1; for (int nxt : gph[now]) { if (chk[nxt] != 2) dfs(nxt); } chk[now] = 2; } int main() { scanf("%d", &n); for (int i = 1, u; i < n; i++) { scanf("%d", &m); while (m--) { scanf("%d", &u);...

      boj dfs

      wookje.kwon's profile image

      wookje.kwon

      2018-09-06 15:43

    • [BOJ] 11281 : 2-SAT - 4

      11281 : 2-SAT - 4 풀이 참 아프다 니가 너무 아프다 너를 닮은 이 시린 가을이 오면 보고 싶어서 너를 안고 싶어서 가슴이 너를 앓는다 코드 #include <cstdio> #include <stack> #include <vector> #include <algorithm> using namespace std; typedef vector<int> vi; const int n_ = 10000*2+2; int n, m, cnt, scc[n_], chk[n_], ans[n_]; vi gph[n_]; vector<vi> res; stack<int, vi> stk; int getSCC(int now) { chk[now] = ++cnt; int ret = chk[now]; stk.push(now); for (int nxt :...

      boj 2-sat

      wookje.kwon's profile image

      wookje.kwon

      2018-09-06 13:50

    • Previous Page
    • 10
    • 11
    • 12
    • 13
    • 14
    • Next Page
    • github
    • facebook
    • rss

    Copyright © Wookje Kwon. All rights reserved.