본문 바로가기

분류 전체보기

(87)
Grub 으로 Default Kernel 설정하기 간혹 부팅할 때 설치한 kernel version 으로 booting 되는 것이 아니라, 이전에 깔린 kernel 로 update 되는 경우가 있다. 이를 다음과 같은 command로 해결해보자 grub2-set-default 0 # 숫자는 원하는 kernel index PS. 해당 Command 는 CentOS 9 Stream 에서 동작한다.
For 문 에서의 List Comprehension List Comprehension 중 Invalid Syntax 가 떠서 오답 노트 식으로 올려본다. For 문에서 List Comprehension 사용 시 조건 문은 for keyword 앞에 나와야 한다. 예를 들면 다음과 같다 # A 만 소문자로 바꾸고 나머지는 X로 바꾸는 Code orig = 'ABCDE' convert = ''.join([o.lower() if o == 'A' else 'X' for o in orig]) 참고 : https://velog.io/@jonsyou/Python-list-comprehension-%EC%95%88%EC%97%90-if-else
BOJ 15587 Cow at Large (Gold) https://www.acmicpc.net/problem/15587 15587번: Cow at Large (Gold) Cornered at last, Bessie has gone to ground in a remote farm. The farm consists of $N$ barns ($2 \leq N \leq 10^5$) and $N-1$ bidirectional tunnels between barns, so that there is a unique path between every pair of barns. Every barn which has only one tun www.acmicpc.net 1차 접근 Bassie 기준 Depth와, Farmers 기준 Depth 둘 다 구해놓고, 어떻게 계산하면..
BOJ 14169 Laser and Mirrors https://www.acmicpc.net/problem/14169 14169번: Lasers and Mirrors The first line of input contains 5 space-separated integers: N,xL,yL,xB,yB, where (xL,yL) is the location of the laser and (xB,yB) is the location of the barn. All coordinates are between 0 and 1,000,000,000. The next N lines each contain the x and y locat www.acmicpc.net 풀이를 떠올리는건 어렵지 않았는데, 크고작은 구현 문제가 있었다. 하여 오답노트 차 적어본다. 풀이는 다음과..
BOJ 16765 Teamwork https://www.acmicpc.net/problem/16765 16765번: Teamwork In this example, the optimal solution is to group the first three cows and the last three cows, leaving the middle cow on a team by itself (remember that it is fine to have teams of size less than $K$). This effectively boosts the skill levels of the 7 cow www.acmicpc.net 문제 자체는 간단하지만, 이 문제를 풀 때 접근했던 방식이 앞으로 도움이 될 것 같아 포스팅 하게 되었다. 선 요약하면 다음과..
BOJ 15749 Snow Boots https://www.acmicpc.net/problem/15749 15749번: Snow Boots It's winter on the farm, and that means snow! There are $N$ tiles on the path from the farmhouse to the barn, conveniently numbered $1 \dots N$, and tile $i$ is covered in $f_i$ feet of snow. Farmer John starts off on tile $1$ and must reach tile $N$ to wa www.acmicpc.net 간단한 DP문제였지만, 코드를 확인하지 못해 기록을 남긴다. 신발을 갈아신어야 하는 조건이 for(int k=1; k n ..
BOJ 15750 Teleportation https://www.acmicpc.net/problem/15750 15750번: Teleportation In this example, by setting $y = 8$ FJ can achieve $d_1 = 2$, $d_2 = 5$, and $d_3 = 3$. Note that any value of $y$ in the range $[7,10]$ would also yield an optimal solution. www.acmicpc.net 솔직히 딱 보고 도저히 감이 오지 않아서 BOJ 에서 제공하는 힌트를 살짝 봤다. 더보기 힌트는 수학, 스위핑이였다. 생각보다 간단한 풀이였기에, 문제 난이도는 잊고 다시 접근해봤다. 몇개의 그래프를 그려보니 특정 구간 a->b 일 때, Teleport를 x 에 ..
BOJ 15589 Lifeguards (Silver) https://www.acmicpc.net/problem/15589 15589번: Lifeguards (Silver) The first line of input contains $N$ ($1 \leq N \leq 100,000$). Each of the next $N$ lines describes a lifeguard in terms of two integers in the range $0 \ldots 1,000,000,000$, giving the starting and ending point of a lifeguard's shift. All such endpoints www.acmicpc.net 다른 시간대에 포함되는 어떤 시간대가 존재한다면, 해당 시간대의 guard 를 해고하면 된다. 서로 포함되..