https://www.acmicpc.net/problem/15686 15686번: 치킨 배달 크기가 N×N인 도시가 있다. 도시는 1×1크기의 칸으로 나누어져 있다. 도시의 각 칸은 빈 칸, 치킨집, 집 중 하나이다. 도시의 칸은 (r, c)와 같은 형태로 나타내고, r행 c열 또는 위에서부터 r번째 칸 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 from itertools import combinations n, m = map(int, input().split()) graph = [[0] for _ in range(n + 1)] homes = list() stores = li..
https://www.acmicpc.net/problem/3190 3190번: 뱀 'Dummy' 라는 도스게임이 있다. 이 게임에는 뱀이 나와서 기어다니는데, 사과를 먹으면 뱀 길이가 늘어난다. 뱀이 이리저리 기어다니다가 벽 또는 자기자신의 몸과 부딪히면 게임이 끝난다. 게임 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 from collections import deque go_dir = ((0, 1), (1, 0), (0, -1), (-1, 0)) dir = 0 time..
https://www.acmicpc.net/problem/18406 18406번: 럭키 스트레이트 첫째 줄에 점수 N이 정수로 주어진다. (10 ≤ N ≤ 99,999,999) 단, 점수 N의 자릿수는 항상 짝수 형태로만 주어진다. www.acmicpc.net 1 2 3 4 5 n = input() if sum([int(c) for c in n[:len(n) // 2]]) == sum([int(c) for c in n[len(n) // 2:]]): print('LUCKY') else: print('READY') Colored by Color Scripter cs 알고리즘을 분류하기도 어려운 문자열 다루는 문제이다.
https://www.acmicpc.net/problem/1439 1439번: 뒤집기 다솜이는 0과 1로만 이루어진 문자열 S를 가지고 있다. 다솜이는 이 문자열 S에 있는 모든 숫자를 전부 같게 만들려고 한다. 다솜이가 할 수 있는 행동은 S에서 연속된 하나 이상의 숫자를 잡고 모 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 s = input() val = s[0] count = 0 for c in s: if val != c: val = c count += 1 if count % 2 == 0: print(count // 2) else: print(count // 2 + 1) cs 간단한 그리디 문제이다. 앞에서부터 탐색하며 문자가 바뀌면 count를 증가시키고, 마지막에 co..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 import sys input = sys.stdin.readline n, m = map(int, input().split()) parent = [i for i in range(n + 1)] edges = list() def find_parent(c): if parent[c] != c: parent[c] = find_parent(parent[c]) return parent[c] def union(a, b): ap, bp = find_parent(a), find_parent(b) if ap
12345678910111213141516171819202122232425262728293031323334353637383940#include #include #include using namespace std; class AbsHeap {private: int num;public: AbsHeap(int num) : num(num) {}; int getNum() { return this->num; }}; bool operator>(AbsHeap h1, AbsHeap h2) { if (abs(h1.getNum()) == abs(h2.getNum())) return h1.getNum() > h2.getNum(); else return abs(h1.getNum()) > abs(h2.getNum());} int..
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657#include #include using namespace std; bool bfs(int** arr, int size) { bool* visited = new bool[size] { true, }; queue q; q.push(0); while (!q.empty()) { int now = q.front(); q.pop(); if (now == size - 1) return true; for (int i = 0; i
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667#include #include #include using namespace std; int arr[100][100][100]{ 0, };int visited[100][100][100]{ 0, };queue order; int bfs(int sizeH, int sizeN, int sizeM, int nu) { int max = 1; while (!order.empty()) { tuple now = order.front(); order.pop(); nu++; max = arr[get(n..
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859#include #include using namespace std; int bfs(int** arr, int** visited, int size, int x, int y) { queue order; order.push({ x, y }); int num = 0; visited[x][y] = 1; while (!order.empty()) { pair now = order.front(); order.pop(); num++; if (now.first + 1 = 0 && arr[now.first - 1][now.seco..
- Total
- Today
- Yesterday
- 구현
- 컨트리뷰톤
- 브루트포스
- LG
- DFS
- DP
- 정렬
- 카카오
- 이분탐색
- 피보나치
- 한화큐셀
- Dynamic Programming
- 오픈소스
- 동적 계획법
- 플로이드 와셜
- 프로그래머스
- 완전탐색
- c++
- 파이썬
- BFS
- c
- BaekJoon
- 알고리즘
- webOS
- 인공지능
- 백준
- 백트래킹
- 코딩
- PyPy3
- 1932
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |