전체 글(334)
-
[BOJ] 1978번 : 소수 찾기
1. problem : https://www.acmicpc.net/problem/1978 2. solution 1 :#include using namespace std;int n; bool isprime(int a) { if (a == 1) return 0; for (int i = 2; i * i > n; int cnt = 0; for (int i = 0; i > x; cnt += isprime(x); } cout 소수를 찾기 위해서는 숫자 a가 있을 때, root(a)까지만 검사를 해보면 된다. 그 이유는 어떤 수 a의 1이 아닌 제일 작은 약수를 x라고 하자. 이때, a를 x로 나눈 값, 즉, (a / x)는 x보다 크거나 같은 값이 된다. 따라서, x
2024.09.22 -
[Git Bash] scp를 이용하여 파일 전송하기
0. vm 환경 local 저장소로 파일 전송하기 위해 Git Bash가 필요하다. https://git-scm.com/download/win 1. 설치가 끝났으면, git bash를 켜준다. vm ---> local로 파일 전송방법 scp [vm 주인 이름]@[vm ip]:/file/to/send/pathway/ [받고 싶은 local 저장소 위치]
2024.09.22 -
[BioPython] Bio.Phylo
0. Bio.Phylo 모듈은 계통을 그려주는 모듈이다. Bio.Phylo는 4개의 파일형식을 읽을 수 있다. Newick, Nexus, Phyloxml, Nexml 1. 사용법 from Bio import Phylotree = Phylo.read("../nwk/sample_tree1.nwk","newick")tree.rooted = Truetree.root.color = (128,128,128)print(tree)tree.clade[0].color = "blue"tree.clade[1].color = "red"tree.clade[2,0].color = "green"tree.clade[2,1].color = "green"Phylo.draw(tree, branch_labels = lambda c : c..
2024.09.22 -
[Oracle vm] Ubuntu shared folder 만들기
0. ubuntu에서 만든 파일을 local 환경에서 쓰고싶었다. 하지만, 복사가 불가능했고, shared folder를 생성하여야했다. 1. Shared Folder (공유 폴더) 설정 (가장 간단한 방법)Oracle VM VirtualBox에서는 가상 머신과 호스트(로컬 컴퓨터) 간에 파일을 쉽게 공유할 수 있는 공유 폴더 기능이 있습니다. 이 방법이 가장 직관적이고 간편합니다.공유 폴더 설정 방법:VirtualBox 설정:가상 머신을 실행하지 않은 상태에서 VirtualBox 메인 창에서 가상 머신을 선택한 후, 상단의 Settings(설정) 버튼을 클릭합니다.설정 메뉴에서 Shared Folders(공유 폴더) 탭을 클릭합니다.오른쪽 상단의 **폴더 추가 아이콘(+)**을 클릭하여 공유할 폴더를..
2024.09.22 -
[BOJ] 2156번 : 포도주 시식
1. problem : https://www.acmicpc.net/problem/2156 2. solution 1 :#include using namespace std;int n; int d[10005][3]; int a[10005];int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i > a[i]; d[1][1] = a[1]; for (int i = 2; i source code 출처 : https://github.com/encrypted-def/basic-algo-lecture/blob/master/0x10/solutions/2156_1.cpp basic-algo-lecture/0x10/solutions..
2024.09.22 -
[BOJ] 11656번 : 접미사 배열
1. problem : https://www.acmicpc.net/problem/11656 2. solution 1: #include using namespace std;string s; vector prefix; int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> s; for (int i = 0; i prefix라는 배열을 만들어, 접미사들을 추가했다. 정렬은 sort()를 이용했고 , 비교연산자는 lambda함수로 작성했다. 3. solution 2 : // Authored by : std-freejia// Co-authored by : -//http://boj.kr/21378a10916b42d19dce4bc7c841a73c#include ..
2024.09.21