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

    Wookje blog

    알고리즘 블로그였던 것

    Featured Posts
    • [BOJ] 12842 : 튀김 소보루

      12842 : 튀김 소보루 풀이 . 코드 #include <cstdio> int n, m, time, idx, a[100001]; int main() { scanf("%d %d", &n, &m); n -= m; scanf("%d", &m); for (int i = 1; i <= m; i++) scanf("%d", a + i); while (n) { for (int i = 1; i <= m; i++) { if (time % a[i] == 0) { n--; idx = i; if (!n) break; } } time++; } printf("%d\n", idx); return 0;...

      boj naive

      wookje.kwon's profile image

      wookje.kwon

      2018-06-24 22:08

    • [BOJ] 12841 : 정보대 등산

      12841 : 정보대 등산 풀이 누적합! 코드 #include <cstdio> typedef long long ll; int n, i; ll a[100001], b[100001], c[100002]; int main() { scanf("%d", &n); for (i = 1; i <= n; i++) scanf("%lld", c + i); for (i = 2; i <= n; i++) scanf("%lld", a + i), a[i] += a[i-1]; for (i = 2; i <= n; i++) scanf("%lld", b + i), b[i] += b[i-1]; ll pos = 1, sum = 1e18; for...

      boj naive

      wookje.kwon's profile image

      wookje.kwon

      2018-06-24 22:06

    • [BOJ] 12840 : 창용이의 시계

      12840 : 창용이의 시계 풀이 , 코드 #include <cstdio> int main() { int h, m, s, tc, t, c, mod = 86400; scanf("%d %d %d", &h, &m, &s); s += m * 60 + h * 3600; for (scanf("%d", &tc); tc; tc--) { scanf("%d", &t); if (t == 1) scanf("%d", &c), s = (s + c) % mod; if (t == 2) scanf("%d", &c), s = (s - c) % mod; if (t == 3)...

      boj naive

      wookje.kwon's profile image

      wookje.kwon

      2018-06-24 22:05

    • [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

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

    Copyright © Wookje Kwon. All rights reserved.