This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BOJ 1712 손익분기점 | |
def solve(a, b, c): | |
n = c - b | |
if n <= 0: | |
return -1 | |
else: | |
return a // n + 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ### 체스판 조각 문제 | |
# ```plantuml | |
# @startuml | |
# autonumber | |
# 상근이 --> 동혁이: 체스판을 톱으로 자르려고 한다. | |
# 상근이 --> 동혁이: | |
# note left | |
# 1. 체스판을 최대 N번 자를 수 있고, | |
# 2. 변에 평행하게만 자를 수 있다. | |
# 3. 또 자를 때는 체스판의 그 변의 한쪽 끝에서 다른쪽 끝까지 잘라야 한다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solve(a, b): | |
return abs(a - b) | |
if __name__ == '__main__': | |
a, b = map(int, input().split()) | |
print(solve(a, b)) | |
def test_input_1(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solve(numbers: list): | |
tot = sum(numbers) | |
if tot == 0: | |
return 0 | |
elif tot > 0: | |
return '+' | |
elif tot < 0: | |
return '-' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:18.04 | |
######################################################## | |
# Essential packages for remote debugging and login in | |
######################################################## | |
RUN apt-get update && apt-get upgrade -y && apt-get install -y \ | |
apt-utils gcc g++ openssh-server cmake build-essential gdb gdbserver rsync vim | |
RUN mkdir /var/run/sshd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
gdbserver: | |
build: | |
context: ./ | |
dockerfile: ./Dockerfile | |
image: clion_dev | |
security_opt: | |
- seccomp:unconfined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM centos:7 | |
RUN useradd dev | |
RUN echo 'dev:mypass' | chpasswd | |
RUN yum install -y openssh-server rsync | |
RUN ssh-keygen -N '' -t rsa -f /etc/ssh/ssh_host_rsa_key && \ | |
ssh-keygen -N '' -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key && \ | |
ssh-keygen -N '' -t ed25519 -f /etc/ssh/ssh_host_ed25519_key | |
RUN echo /usr/sbin/sshd >> /root/.bashrc && source /root/.bashrc | |
RUN sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/' /etc/ssh/sshd_config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solve(real_list, dream_list): | |
real_cnt = len(real_list) | |
dream_cnt = len(dream_list) | |
max_level_cnt = (dream_cnt - real_cnt) // (real_cnt - 1) | |
# 첫번째 원소를 구한다. | |
first_elem = real_list[0] | |
first_elem_idx_list = [] | |
min_max = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
# 문제 : 파스칼의 삼각형 | |
* 파스칼의 삼각형은 수학의 이항 계수를 삼각형의 형태로 숫자를 배열한 구성을 말한다. | |
* 파스칼의 삼각형은 처음 두 줄을 제외하고 새로 만들어지는 줄의 새로운 숫자는 윗줄의 왼쪽 수와 오른쪽 수를 더해서 만들어진다. | |
* 또한 제일 맨 첫줄의 하나의 숫자는 1이다. | |
1 | |
1 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
## 문제 : 배열에서 다수의 요소 찾기 | |
- 정수형 배열이 주어졌을 때, 다수의 요소를 찾아보자. | |
- 다수의 요소는 배열 내에서 [n / 2] 번 (floor(n / 2))를 초과하여 나타나는 요소를 말한다. | |
- 예를 들어서, 배열 요소의 총 개수가 9개라면, n / 2는 4.5이다. 결국에 5번 이상 나타나는 요소를 찾으면 된다. | |
- 배열은 항상 1개 이상의 요소를 가지고 있으며, 다수의 수가 무조건 하나 존재 한다고 가정하자. | |
## 제한사항 : | |
- 정수형 배열이 주어진다. |
OlderNewer