분류 전체보기
-
[백준 1012] 유기농 배추 C++ (bfs, dfs)study/PS 2020. 2. 10. 16:38
BFS, DFS를 이용하는 탐색문제인 유기농 배추입니다. 저는 BFS를 이용하며 풀었지만, DFS역시 사용 가능합니다. 테스트 케이스 방식의 입력을 받기 때문에 각각의 테스트 케이스마다 배열을 초기화 해주는 부분이 필요로 합니다. 풀이 #include #include #include using namespace std; typedef pair p; queue q; int n, m, k; int map[51][51]; int visited[51][51]; int cross_x[] = {0, 0, -1, 1}; int cross_y[] = {1, -1, 0, 0}; void bfs(int x, int y) { visited[x][y] = 1; while (!q.empty()) { x = q.front().f..
-
알고리즘 - 배낭문제 (Knapsack Problem)study/알고리즘 2020. 2. 9. 17:32
배낭문제는 조합 최적화의 유명한 문제입니다. 한 가방에 넣을 수 있는 무게의 최대 값이 정해져 있을 때, 일정한 가치와 무게가 있는 물건들을 가치의 합이 최대가 되도록 가방에 넣는 방법을 찾는 문제입니다. 분할 가능 문제 (Fractional Knapsack Problem) 짐을 쪼갤 수 있는 경우 그리디 알고리즘(greedy method)으로 다항 시간 안에 풀이 가능하다. 0-1 배낭 문제 (0-1 Knapsack Problem) 짐을 쪼갤 수 없는 경우 동적 계획법(dp)등을 사용하여 의사 다항 시간 안에 풀이 가능하다. NP-완전이기 때문에 FPTAS만 존재한다. reference - https://ko.wikipedia.org/wiki/배낭_문제
-
[C언어] scanf, printf를 사용하여 세개의 수를 입력받아 곱한 값을 출력하기study 2012. 3. 13. 23:38
오늘 포스팅할 글은 c언어의 기초이자 많이 사용하게되 표준 입출력함수인 scanf 와 printf를 이용한 간단하게 세가지의 수를 입력받아 모두 곱한값을 출력하는 프로그램을 만들겠습니다. 4번 코드 : int를 사용하여 a,b,c,gob(곱)를 선언해줍니다. 5번 코드 : pritnf(출력함수)를 이용하여 사용자에게 정보를 알려줍니다. 6번 코드 : scanf(입력합수)를 이용하여 4번에서 선언한 a,b,c에 값을 입력받게 해줍니다. %d는 인수를 10진수로 출력하는 변환문자입니다. 7번 코드 : 4번에서 선언한 gob(곱)에 a*b*c (세수의 곱) 계산을 해줍니다. 이때 계산의 결과는 선언한 gob(곱)에 지정됩니다. 8번 코드 : printf를 사용하여 출력합니다 7번 코드에서 계산된 값을 gob이..
-
Wi-Fi 기술 3G, 4G 기술의 정의와 장점, 단점study 2012. 3. 9. 12:02
Wi-Fi = Wireless Fidelity 국문으로는 근거리 무선망으로 유선LAN 형태인 인터넷의 단점을 보완하기 위해 고안된 기술로, 인터넷 네트워크의 말단에 위치해 필요 없는 배선 작업과 유지관리 비용을 최소화하기 위해 널리 쓰이고 있다. 처음에는 군용 네트워크로 개발되었다가 상업화 되었다. 단점으로는 근거리 무선망은 이동 중에는 사용할 수 없으며 송수선거리가 짧아 특정한 거리에서만 사용가능하다. 3G 2002년 12월에 상용화되어 이전 통신기술인 2G에서 발달한 음성, 문자, 사진, 동영상등의 다양한 데이터를 전송 가능한 것이 큰 특징이다. 전송속도는 144K~2.4Mbps로 이전의 2G(14.4 ~ 64kbps)보다 월등히 빠른 속도를 장점으로 가지고 있다. 다운로드 속도로는 800MB동영상 ..
-
윈도우모바일용 무료 GPS Navi (NaviComputer)blog 2012. 1. 14. 20:35
NaviComputer 윈도우 모바일 6.1, 6.5 버전 전용 무료 GPS 네비입니다. 초기 설치시 지역의 지도를 지정하여 저장할수 있게 되어있어 오프라인에 있을때 저장한 지도를 불러오기만 하면 GPS와 연동하여 작동하므로 별도의 wifi나 3g 데이터를 필요로 하지않아 요금을 걱정할 필요가 없는 어플입니다. 1. 일단 첨부파일을 다운받아주세요 2. 모바일폰을 active sync로 연결한후 컴퓨터에서 'NaviComputer V0.94_Setup.exe' 를 설치합니다. 그리고 모바일폰에도 설치합니다.(내부저장소에도 설치 가능합니다.) 3. 'C:\Program Files\NaviComputer\NaviMapper' 에 들어가서 'NaviMapper.exe' 를 실행시켜주세요. 4. 왼쪽 상단에 빈공..
-
버블배열, 정렬 (Bubble Sort)study 2012. 1. 14. 19:55
버블배열, 정렬 (Bubble Sort) 인접한 두 개의 자료를 비교하여 자리를 교환하는 방법으로 정렬하는 것을 버블 정렬(bubble sort)이라 한다. 다섯 장의 숫자 카드로 버블 정렬하는 과정을 나타내면 다음과 같다. 1. 다섯 장의 카드를 임의의 순서대로 나열하여 놓는다. 2. 왼편 두 장의 카드를 비교하여 작은 숫자는 왼쪽, 큰 숫자는 오른쪽에 오도록 위치를 바꾼다. 3. 두 번째 카드와 세 번째 카드의 숫자를 비교 한다. 비교 결과 위치를 바꿀 필요가 없으므로 그대로 둔다. 4. 세 번째 카드와 네 번째 카드의 숫자를 비교하여 위치를 바꾼다. 5. 마지막으로 네 번째 카드와 다섯 번째 카드를 비교하여 위치를 바꾼다. 마지막 카드까지 작업을 수행한 결과 가장 큰 숫자 카드는 맨 오른쪽으로 이동..