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

    서울대학교 프로그래밍 경시대회

    All Posts in snupc

    • [BOJ] 16120 : PPAP

      16120 : PPAP 풀이 일반적인 괄호 문자열 문제랑 비슷하게 해결하면 된다. 코드 #include <cstdio> int t; char a[1000003], s[1000003]; int ppap() { if (t < 4) return 0; if (s[t-4]=='P'&&s[t-3]=='P'&&s[t-2]=='A'&&s[t-1]=='P') return 1; return 0; } int main() { scanf("%s", a); int cnt = 0; for (int i = 0; a[i]; i++) { s[t++] = a[i]; while (ppap()) t -= 4, s[t++] = 'P'; } puts(t == 1 && s[0] == 'P' ? "PPAP" : "NP");...

      boj snupc stack

      wookje.kwon's profile image

      wookje.kwon

      2018-09-14 18:09

    • [BOJ] 16118 : 달빛 여우

      16118 : 달빛 여우 풀이 다익스트라 짜면서 사람들이 많이 놓치는 부분이 있는데 if (dp[now] != current_sum) continue; 위와 같은 동작을 넣은 코드와 그렇지 않은 코드의 시간복잡도가 다르다. (자세히는 모름) 이 문제의 경우, 데이터가 엄청 빡세서 저 동작을 넣어주지 않으면 시간 초과를 받게 된다. 아래의 코드를 참고하자. 코드 #include <cstdio> #include <vector> #include <queue> #include <algorithm> using namespace std; typedef long long ll; int n, m; struct edg { int idx, cnt; ll dst; bool operator...

      boj snupc dijkstra

      wookje.kwon's profile image

      wookje.kwon

      2018-09-14 18:08

    • [BOJ] 16113 : 시그널

      16113 : 시그널 풀이 잘 짜면 된다 코드 #include <cstdio> #include <cstring> int n, r[100003]; char a[100003], s[20005][5]; int isone(int x) { for (int i = 0; i < 5; i++) if (s[x][i] == '.' || s[x+1][i] == '#') return 0; return 1; } int count(int x) { int ret = 0; for (int i = x; i < x+3; i++) for (int j = 0; j < 5; j++) ret += s[i][j] == '.';...

      boj snupc string naive

      wookje.kwon's profile image

      wookje.kwon

      2018-09-14 18:07

    • [BOJ] 16112 : 5차 전직

      16112 : 5차 전직 풀이 메이플스토리~~ 코드 #include <cstdio> #include <algorithm> int n, k, a[300003]; long long r, s; int main() { scanf("%d %d", &n, &k); for (int i = 0; i < n; i++) scanf("%d", &a[i]); std::sort(a, a+n); for (int i = n-1; i >= 0; i--) { if (i < k) r += s; s += (long long)a[i]; } printf("%lld", r); return 0; } 아무말 백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge,...

      boj snupc naive

      wookje.kwon's profile image

      wookje.kwon

      2018-09-14 18:06

    • github
    • facebook
    • rss

    Copyright © Wookje Kwon. All rights reserved.