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

    Wookje blog

    알고리즘 블로그였던 것

    Featured Posts
    • [BOJ] 1977 : 완전제곱수

      1977 : 완전제곱수 풀이 음 잘 세어주면 된다 코드 #include <stdio.h> int min(int a, int b) { return a < b ? a : b; } int a, b, sm, mn = (int)1e9; int main() { scanf("%d %d", &a, &b); for (int i = 1; i*i <= b; i++) { if (i*i >= a && i*i <= b) { mn = min(mn, i*i); sm += i*i; } } if (!sm) printf("-1"); else printf("%d\n%d", sm, mn);...

      boj koi math

      wookje.kwon's profile image

      wookje.kwon

      2017-09-19 10:50

    • [BOJ] 1076 : 저항

      1076 : 저항 풀이 잘 계산해주자 꺄르륵 코드 #include <iostream> #include <string> using namespace std; int i, j; long long sum; string a, b, c, s[] = {"black","brown","red","orange","yellow","green","blue","violet","grey","white" }; int main() { cin >> a >> b >> c; for (i = 0; i < 10; i++) { if (a == s[i]) sum += i * 10; if (b == s[i]) sum += i; } for (i = 0; i < 10; i++) if (c...

      boj math string

      wookje.kwon's profile image

      wookje.kwon

      2017-09-19 10:46

    • [BOJ] 1475 : 방 번호

      1475 : 방 번호 풀이 6과 9는 구분없이 사용 가능하므로 그것만 신경써서 카운팅 해주면 된다 코드 #include <stdio.h> #include <string.h> #define max(a,b) (a)>(b)?(a):(b) int ans, tmp, cnt[10]; char str[10]; int main() { scanf("%s", str); for (int i = 0; i < strlen(str); i++) cnt[str[i] - '0']++; for (int i = 0; i <= 9; i++) if (i != 6 && i != 9) ans = max(ans, cnt[i]); ans = max(ans, (cnt[6] + cnt[9] + 1)...

      boj math string

      wookje.kwon's profile image

      wookje.kwon

      2017-09-19 10:20

    • [BOJ] 10159 : 저울

      10159 : 저울 풀이 a와 b의 대소관계를 알 수 있다는 것은 a에서 b까지 알고 있는 관계를 건너건너 도착할 수 있다는 것이고 n 제한이 100으로 엄청 작으므로 모든 경로를 구해놓자. 그리고 도달할 수 없는 노드의 개수를 세어주자. 코드 #include <stdio.h> int n, m, a[101][101]; int main() { scanf("%d %d", &n, &m); for (int i = 0, x, y; i < m; i++) scanf("%d %d", &x, &y), a[x][y] = 1; for (int k = 1; k <=...

      boj koi floyd

      wookje.kwon's profile image

      wookje.kwon

      2017-09-17 00:14

    • [BOJ] 10158 : 개미

      10158 : 개미 풀이 개미가 움직이는 w*h 크기의 격자가 사방에 이어붙여져 있다고 생각해보자. w - abs(w - (x + t) % (2 * w)), h - abs(h - (y + t) % (2 * h)) 나머지 연산을 이용하면 간단하게 풀 수 있다. 코드 #include <bits/stdc++.h> int w, h, x, y, t; int main() { scanf("%d %d %d %d %d", &w, &h, &x, &y, &t); printf("%d %d", w - abs(w - (x + t) % (2...

      boj koi math

      wookje.kwon's profile image

      wookje.kwon

      2017-09-17 00:09

    • [BOJ] 10157 : 자리배정

      10157 : 자리배정 풀이 달팽이 짜듯이 하면 된다 코드 #include <stdio.h> const int dx[] = { 1,0,-1,0 }; const int dy[] = { 0,1,0,-1 }; int n, m, c, a[1002][1002]; int main() { scanf("%d %d %d", &n, &m, &c); for (int i = 0; i <= 1001; i++) a[i][0] = a[0][i] = a[m + 1][i] = a[i][n + 1] = 1; int x = 0, y = 1, d = 0; for (int i =...

      boj koi naive

      wookje.kwon's profile image

      wookje.kwon

      2017-09-17 00:07

    • [BOJ] 10156 : 과자

      10156 : 과자 풀이 꺄르륵 코드 main(a,b,c){scanf("%d%d%d",&a,&b,&c);printf("%d",a*b-c>0?a*b-c:0);} 아무말 백준, 백준 온라인 저지, BOJ, Baekjoon Online Judge, C, C++, 씨, 씨쁠쁠, JAVA, algorithm, 자바, 알고리즘, 자료구조, 문제, 문제 풀이, 풀이

      boj koi naive

      wookje.kwon's profile image

      wookje.kwon

      2017-09-17 00:05

    • [BOJ] 4586 : Image Compression

      4586 : Image Compression 풀이 흑흑 문제를 잘못 읽어서 한 번 틀렸다 ㅠㅠ 네 조각씩 나눠서 분할정복을 하면 된다. 제한이 크지 않으므로 나이브하게 사각형을 다 돌아보면 된다. 룰루 코드 #include <stdio.h> #define y1 fuck typedef double db; int n, t; char a[66][66]; void go(int x1, int y1, int x2, int y2) { if (x1 == x2 && y1 == y2) return; int siz = (x2 - x1 + 1) * (y2 - y1 + 1),...

      boj acm-icpc divide-and-conquer

      wookje.kwon's profile image

      wookje.kwon

      2017-09-03 18:12

    • [BOJ] 6191 : Cows on Skates

      6191 : Cows on Skates 풀이 (1,1)~(r,c)까지의 경로를 찾아주자! 왜 이게 usaco gold 문제인지는 모르겠다 ㅋㅋㅋ 코드 #include <stdio.h> #include <algorithm> #include <queue> using namespace std; const int dx[] = { 0,0,-1,1 }, dy[] = { -1,1,0,0 }; struct ABC { int x, y; }; int n, m; char a[123][123]; ABC chk[123][123]; queue<ABC> que; void f(int x, int y) { if (x != 1 || y != 1) f(chk[x][y].x, chk[x][y].y); printf("%d %d\n", x, y); }...

      boj usaco bfs

      wookje.kwon's profile image

      wookje.kwon

      2017-09-03 01:22

    • [BOJ] 2786 : 상근이의 레스토랑

      2786 : 상근이의 레스토랑 풀이 (첫 주문) 가격과 (일반 주문) 가격이 나누어져있다. 일반 가격으로 정렬한 뒤 1~i번째 가격의 합을 구해놓고 생각하자. 그럼 두 가지의 케이스로 나눌 수 있다. 1~i번째 메뉴들 중 (첫 주문)과 (일반 주문) 가격의 차이가 가장 큰 것을 고르는 경우 i~n번째 메뉴들 중 (첫 주문)의 가격이 가장 작은 것을 고르는 경우 이제 어찌저찌여차저차 잘 짜면 된다. 코드 #include <stdio.h> #include <algorithm> #define fst first #define snd second using namespace std; typedef pair<int, int>...

      boj coi math

      wookje.kwon's profile image

      wookje.kwon

      2017-09-03 00:46

    • Previous Page
    • 32
    • 33
    • 34
    • 35
    • 36
    • Next Page
    • github
    • facebook
    • rss

    Copyright © Wookje Kwon. All rights reserved.