| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- 혼자 공부하는 C언어
- C programming
- 윤성우의 열혈 자료구조
- Graph
- 이것이 자바다
- Selection Sorting
- R
- list 컬렉션
- Algorithm
- datastructure
- buffer
- 이스케이프 문자
- Serialization
- JSON
- s
- Stack
- C 언어 코딩 도장
- insertion sort
- stream
- 메모리구조
- coding test
- 알기쉬운 알고리즘
- 윤성우 열혈자료구조
- Today
- Total
목록Problem Solving/BOJ (76)
Engineering Note
문제 https://www.acmicpc.net/problem/18258 [ 18258번: 큐 2 첫째 줄에 주어지는 명령의 수 N (1 ≤ N ≤ 2,000,000)이 주어진다. 둘째 줄부터 N개의 줄에는 명령이 하나씩 주어진다. 주어지는 정수는 1보다 크거나 같고, 100,000보다 작거나 같다. 문제에 나와있지 www.acmicpc.net ](https://www.acmicpc.net/problem/18258) 코드 import sys from collections import deque #sys.stdin = open("input.txt","rt") n = int(sys.stdin.readline().rstrip()) q = deque() for _ in range(n): cmd = sys.std..
it 취업을 위한 알고리즘 문제 풀이 문제 https://www.acmicpc.net/problem/10951 [ 10951번: A+B - 4 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. www.acmicpc.net ](https://www.acmicpc.net/problem/10951) 코드 import sys #sys.stdin = open("input.txt","rt") while True: try: num1, num2 = map(int, sys.stdin.readline().rstrip().split()) print(num1 + num2) except: break 문제해결방법 쉬운문제 지만 try, except 구문을 모르면 당황할 수 있는 문제이다. 다른 문제들과..
it 취업을 위한 알고리즘 문제 풀이 문제 https://www.acmicpc.net/problem/10828 [ 10828번: 스택 첫째 줄에 주어지는 명령의 수 N (1 ≤ N ≤ 10,000)이 주어진다. 둘째 줄부터 N개의 줄에는 명령이 하나씩 주어진다. 주어지는 정수는 1보다 크거나 같고, 100,000보다 작거나 같다. 문제에 나와있지 www.acmicpc.net ](https://www.acmicpc.net/problem/10828) 코드 import sys #sys.stdin = open("input.txt","rt") N = int(sys.stdin.readline()) stack = [None]*10001 top = -1 def Push(data): global top global st..
it 취업을 위한 알고리즘 문제 풀이 문제 https://www.acmicpc.net/problem/4485 코드 import sys from collections import deque sys.stdin = open("input.txt","rt") INF = 9999999 dirX = [0,0,-1,1] dirY = [-1,1,0,0] def BFS(y,x,graph,cost): q = deque() q.append((y,x)) while q: curY, curX = q.popleft() for i in range(4): ny = curY + dirY[i] nx = curX + dirX[i] if ny = n or nx >= n: continue if cost[ny..
it 취업을위한알고리즘문제풀이 문제 https://www.acmicpc.net/problem/2753 코드 #include int main(){ int year = 0; scanf("%d",&year); if(year % 4 ==0 && year % 100 != 0 || year % 400 ==0) printf("1"); else printf("0"); return 0; } 문제해결방법 논리연산자를 이용해서 해결했다. 문제에서 주어진 년도를 yeqr 변수에 저장한다. year가 4의 배수이면서 100의 배수가 아닌지(조건 A) 판단하고 또는 400의 배수인지(조건 B) 판단해서 조건 A 또는 B가 만족하면 윤년이므로 1을 출력하고 이 조건이 만족하지 않으면 0을 출력하도록 했다. 이때 윤년이기 위해서는 ..
문제 https://www.acmicpc.net/problem/16236 코드 //https://www.acmicpc.net/problem/16236 #include #include #include #include using namespace std; int map[20][20]; int visited[20][20]; int dr[] = { -1,1,0,0 }; int dc[] = { 0,0,-1,1 }; int n; int Sharksize = 2; int ateCnt; struct Shark { int row, column; }; vector eatFish; void BFS(Shark sharkStart) { queue q; q.push(sharkStart); while (!q.empty()) { S..
문제 https://www.acmicpc.net/problem/16234 [ 16234번: 인구 이동 N×N크기의 땅이 있고, 땅은 1×1개의 칸으로 나누어져 있다. 각각의 땅에는 나라가 하나씩 존재하며, r행 c열에 있는 나라에는 A[r][c]명이 살고 있다. 인접한 나라 사이에는 국경선이 존재한다. 모 www.acmicpc.net ](https://www.acmicpc.net/problem/16234) 코드 //https://www.acmicpc.net/problem/16234 //DFS 풀이, 인구 총합을 return 값으로 반환하도록 풀이 #include #include int n, l, r, cnt; int map[50][50]; int visited[50][50]; int dirR[] = { ..
문제 https://www.acmicpc.net/problem/2529 [ 2529번: 부등호 여러분은 제시된 부등호 관계를 만족하는 k+1 자리의 최대, 최소 정수를 첫째 줄과 둘째 줄에 각각 출력해야 한다. 단 아래 예(1)과 같이 첫 자리가 0인 경우도 정수에 포함되어야 한다. 모든 입력 www.acmicpc.net ](https://www.acmicpc.net/problem/2529) 코드 // //https://www.acmicpc.net/problem/2529 #include #include void swap(int a, int b); void permu(int flag, int start, int end); int check(); void findMaxMin(int flag); char st..