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

    Wookje blog

    알고리즘 블로그였던 것

    Featured Posts
    • [BOJ] 1866 : 택배

      1866 : 택배 풀이 , 코드 #include <cstdio> #include <algorithm> using namespace std; int n, t, h, a[3003], dp[3003]; int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); scanf("%d %d", &t, &h); sort(a + 1, a + 1 + n); for (int i = 1; i <= n; i++) { dp[i] = dp[i - 1] + a[i] * t; int cst = h; for (int j = i;...

      boj koi dynamic-programming

      wookje.kwon's profile image

      wookje.kwon

      2018-06-24 22:03

    • [BOJ] 10265 : MT

      10265 : MT 풀이 , 코드 #include <cstdio> #include <vector> #include <algorithm> using namespace std; using vi = vector<int>; const int n_ = 1e3 + 1; int n, k; int a[n_], vst[n_], cyc[n_], scc[n_], dph[n_], dp[n_]; vector<int> b[n_]; int c_dfs(int now, int dep, int num) { vst[now] = num, dph[now] = dep; if (vst[a[now]] == num) return dph[now] - dph[a[now]] + 1; return c_dfs(a[now], dep + 1, num); } int s_dfs(int now, int num) {...

      boj acm-icpc scc dynamic-programming graph

      wookje.kwon's profile image

      wookje.kwon

      2018-06-24 22:02

    • [BOJ] 7562 : 나이트의 이동

      7562 : 나이트의 이동 풀이 . 코드 #include <cstdio> #include <cstring> #include <queue> using namespace std; typedef pair<int, int> pii; const int dx[] = { 1,2,2,1,-1,-2,-2,-1 }; const int dy[] = { -2,-1,1,2,2,1,-1,-2 }; int n, x, y, a, b, dst[303][303]; queue<pii> que; int main() { int tc; for (scanf("%d", &tc); tc; tc--) { scanf("%d %d %d %d %d", &n, &x, &y, &a, &b); que.push({ x,y }); dst[x][y] = 1; while (!que.empty()) { pii now...

      boj bfs dfs

      wookje.kwon's profile image

      wookje.kwon

      2018-06-24 21:58

    • [BOJ] 10804 : 카드 역배치

      10804 : 카드 역배치 풀이 . 코드 #include <cstdio> #include <algorithm> using namespace std; int n = 10, a[21]; int main() { int l, r; for (int i=1;i<=20;i++) a[i] = i; while (n--) { scanf("%d %d", &l, &r); reverse(a + l, a + r + 1); } for (int i=1;i<=20;i++) { printf("%d ", a[i]); } return 0; } 아무말 백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge, C, C++, 씨, 씨쁠쁠, JAVA, algorithm, 자바, 알고리즘,...

      boj koi naive

      wookje.kwon's profile image

      wookje.kwon

      2018-06-24 21:57

    • [BOJ] 1506 : 경찰서

      1506 : 경찰서 풀이 . 코드 #include <cstdio> int n, ans, c[101], v[101]; char a[101][101]; int main() { int i, j, k; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &c[i]); for (i = 0; i < n; i++) scanf("%s", a[i]); for (k = 0; k < n; k++) for (i = 0; i < n; i++) for (j = 0; j < n; j++) a[i][j] |= a[i][k] & a[k][j]; for (i...

      boj floyd

      wookje.kwon's profile image

      wookje.kwon

      2018-06-24 21:54

    • [BOJ] 14501 : 퇴사

      14501 : 퇴사 풀이 . 코드 #include <cstdio> int max(int a, int b) { return a > b ? a : b; } int n, t, p, d[22]; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d %d", &t, &p); d[i + 1] = max(d[i + 1], d[i]); d[i + t] = max(d[i + t], d[i] + p); } printf("%d", d[n]); return 0; } 아무말 백준, 백준 온라인...

      boj samsung dynamic-programming

      wookje.kwon's profile image

      wookje.kwon

      2018-06-24 21:52

    • [BOJ] 15678 : 연세워터파크

      15678 : 연세워터파크 풀이 . 코드 #include <cstdio> #include <algorithm> #include <deque> using namespace std; typedef pair<long long, int> pli; int n, d; long long a, now, ans = -1e9; deque<pli> deq; int main() { scanf("%d %d", &n, &d); for (int i = 1; i <= n; i++) { scanf("%lld", &a); while (!deq.empty() && deq.front().second + d < i) deq.pop_front(); now = max(a, a + deq.front().first); ans = max(ans, now); while (!deq.empty() && deq.back().first <=...

      boj naive

      wookje.kwon's profile image

      wookje.kwon

      2018-06-24 21:49

    • [BOJ] 15670 : 도로 공사

      15670 : 도로 공사 풀이 구현이 좀 귀찮은데 잘 따져서 슥슥 짜주면 된다. 코드 #include <cstdio> int n, m, i, x, y, a[100002]; int inc[100002], dec[100002]; int main() { scanf("%d %d", &n, &m); for (i = 1; i <= n; i++) scanf("%d", &a[i]); inc[1] = dec[1] = 1; for (i = 2; i <= n; i++) inc[i] = inc[i - 1] + (a[i - 1] >= a[i]); for (i = 2; i <= n; i++)...

      boj naive

      wookje.kwon's profile image

      wookje.kwon

      2018-06-24 21:47

    • [BOJ] 1068 : 트리

      1068 : 트리 풀이 잘 짜주자. 코드 #include <stdio.h> int n, i, now, del, cnt, gph[51], idg[51]; int main() { scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &gph[i]); if (~gph[i]) idg[gph[i]]++; } scanf("%d", &del); if (gph[del] == -1) return !printf("0"); idg[gph[del]]--; for (i = 0; i < n; i++) { if (idg[i]) continue; cnt++; for (now = i; ~now; now = gph[now]) if (now == del) { cnt--; break; }...

      boj tree graph

      wookje.kwon's profile image

      wookje.kwon

      2018-06-24 21:45

    • [BOJ] 15668 : 방 번호

      15668 : 방 번호 풀이 적당히 큰 수까지 어떻게 잘 돌려주면 된다. 코드 #include <cstdio> #include <cstring> #include <algorithm> int n, ans, cnt[10]; int main() { scanf("%d", &n); for (int i = 1; i < std::min(n, 98765); i++) { memset(cnt, 0, sizeof(cnt)); int a = i, b = n - i, flag = 1; while (a) cnt[a % 10]++, a /= 10; while (b) cnt[b % 10]++, b /= 10; for (int j = 0;...

      boj math

      wookje.kwon's profile image

      wookje.kwon

      2018-06-24 21:41

    • Previous Page
    • 14
    • 15
    • 16
    • 17
    • 18
    • Next Page
    • github
    • facebook
    • rss

    Copyright © Wookje Kwon. All rights reserved.