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

    Wookje blog

    알고리즘 블로그였던 것

    Featured Posts
    • [BOJ] 15559 : 내 선물을 받아줘

      15559 : 내 선물을 받아줘 풀이 boj에 내가 나왔으면 정말 좋겠네~ 정말 좋겠네~~~~ 코드 #include <iostream> using namespace std; int n, m, i, j, ans, cnt = 1, vst[1001][1001]; char a[1001][1001]; int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin >> n >> m; for (i = 0; i < n; i++) cin >> a[i]; for (i = 0; i < n; i++) for (j = 0; j < m; j++) { if (vst[i][j]) continue; int y =...

      boj naive dfs bfs

      wookje.kwon's profile image

      wookje.kwon

      2018-03-31 11:50

    • [BOJ] 5527 : 전구 장식

      5527 : 전구 장식 풀이 다음과 같이 전구가 번갈아 켜진 구간 [x, y]들이 연속되어 있다고 하자. [a, b] [c, d] [e, f] 여기서 (b c), (d e)는 서로 같은 상태(둘 다 켜지거나 꺼지거나)라고 가정하자. 여기서 [c, d] 구간을 flip 해주면 전체 [a, f] 구간이 번갈아 켜지게 된다. 띠용? 코드 #include <cstdio> #include <algorithm> int n, ans, pos = 1, cnt[100001]; int main() { scanf("%d", &n); for (int i = 0, a = -1, b; i...

      boj greedy idea

      wookje.kwon's profile image

      wookje.kwon

      2018-03-31 00:05

    • [BOJ] 9489 : 사촌

      9489 : 사촌 풀이 부모를 찾으러 산으로 갈까요~ 사촌을 찾으러 강으로 갈까요~ 코드 #include <cstdio> int main() { while (1) { int n, k, a[1111] = { -1 }, p[1111] = { -1 }; scanf("%d %d", &n, &k); if (!n && !k) break; int cnt = -1, idx = 0; for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); if (a[i] == k) idx = i; if (a[i] != a[i - 1]...

      boj tree

      wookje.kwon's profile image

      wookje.kwon

      2018-03-30 23:34

    • [BOJ] 14815 : Fresh Chocolate (Small)

      14815 : Fresh Chocolate (Small) 풀이 룰루랄라 코드 #include <cstdio> #include <algorithm> using namespace std; int main() { int tc, t, n, p, c[5]; scanf("%d", &tc); for (t = 1; t <= tc; t++) { c[0] = c[1] = c[2] = c[3] = 0; scanf("%d %d", &n, &p); for (int i = 0, a; i < n; i++) scanf("%d", &a), c[a % p]++; int r = c[0]; if (p == 2) { r += (c[1]...

      boj google-code-jam math

      wookje.kwon's profile image

      wookje.kwon

      2018-03-30 17:05

    • [BOJ] 14816 : Fresh Chocolate (Large)

      14816 : Fresh Chocolate (Large) 풀이 뭔가 제너럴한 규칙을 찾으려고 했는데 잘 모르겠당 p가 2~4밖에 안 되므로 그냥 경우를 나눠서 잘 따져주자. 코드 #include <cstdio> #include <algorithm> using namespace std; int main() { int tc, t, n, p, c[5]; scanf("%d", &tc); for (t = 1; t <= tc; t++) { c[0] = c[1] = c[2] = c[3] = 0; scanf("%d %d", &n, &p); for (int i = 0, a; i < n; i++) scanf("%d", &a),...

      boj google-code-jam math

      wookje.kwon's profile image

      wookje.kwon

      2018-03-30 17:04

    • [BOJ] 12784 : 인하니카 공화국

      12784 : 인하니카 공화국 풀이 루트부터 내려가서 자식들을 끊는 게 좋을지 부모를 끊는 게 좋을지 봐보자. 코드 #include <cstdio> #include <vector> using namespace std; struct edg { int idx, dst; }; vector<edg> gph[1001]; int dfs(int prv, int now, int dst) { int ret = 0; for (edg nxt : gph[now]) if (prv != nxt.idx) ret += dfs(now, nxt.idx, nxt.dst); if (!ret) ret = dst; return ret < dst ? ret : dst; } int main()...

      boj dfs greedy

      wookje.kwon's profile image

      wookje.kwon

      2018-03-30 16:06

    • [BOJ] 11585 : 속타는 저녁 메뉴

      11585 : 속타는 저녁 메뉴 풀이 원순열을 구현하려면 귀찮으니까 똑같은 문자열을 두 번 이어붙여주자 그리고 kmp를 돌려서 substring으로 등장하는 횟수를 구해주자 코드 #include <cstdio> const int n_ = 1e6 + 5; int gcd(int a, int b) { return b ? gcd(b, a%b) : a; } int n, i, j, cnt, fail[n_]; char a[n_], b[n_ * 2]; int main() { scanf("%d", &n); for (i = 0; i < n; i++) scanf(" %c", &a[i]); for (i =...

      boj kmp math

      wookje.kwon's profile image

      wookje.kwon

      2018-03-30 15:36

    • [BOJ] 6209 : 제자리 멀리뛰기

      6209 : 제자리 멀리뛰기 풀이 이분탐색을 해주자 mid를 최소로 뛰는 거리로 두고 파라메트릭 해주자. 코드 #include <cstdio> #include <algorithm> using namespace std; int d, n, m, a[50005]; int main() { scanf("%d %d %d", &d, &n, &m); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); a[n + 1] = d; sort(a + 1, a + n + 1); int lft = 0, rgt = d, ans; while (lft <= rgt) { int mid...

      boj binary-search

      wookje.kwon's profile image

      wookje.kwon

      2018-03-30 10:03

    • [BOJ] 11728 : 배열 합치기

      11728 : 배열 합치기 풀이 조아조아조아조아조아 코드 #include <cstdio> #include <algorithm> int a, b, c[2000001]; int main() { scanf("%d %d", &a, &b); a = b = a + b; while (a--) scanf("%d", &c[a]); std::sort(c, c + b); for (a = 0; a < b; a++) printf("%d ", c[a]); return 0; } 아무말 백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge, C, C++, 씨, 씨쁠쁠, JAVA, algorithm, 자바, 알고리즘, 자료구조, 문제, 문제 풀이, 풀이

      boj sort naive

      wookje.kwon's profile image

      wookje.kwon

      2018-03-28 11:18

    • [BOJ] 1402 : 아무래도이문제는A번난이도인것같다

      1402 : 아무래도이문제는A번난이도인것같다 풀이 a * 1 * 1 * 1 ... 이런 식으로 모든 수를 만들 수 있다. 코드 main(t){for(scanf("%d",&t);t--;)puts("yes");} 아무말 백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge, C, C++, 씨, 씨쁠쁠, JAVA, algorithm, 자바, 알고리즘, 자료구조, 문제, 문제 풀이, 풀이

      boj math naive

      wookje.kwon's profile image

      wookje.kwon

      2018-03-27 18:03

    • Previous Page
    • 18
    • 19
    • 20
    • 21
    • 22
    • Next Page
    • github
    • facebook
    • rss

    Copyright © Wookje Kwon. All rights reserved.