전체 글
-
숫자만 추출 알고리즘(feat.부경대 컴공 장사장)algorism 2020. 1. 2. 16:58
문자와 숫자가 섞여있는 문자열이 주어지면 그 중 숫자만 추출하여 그 순서대로 자연수를 만든다. 만들어진 자연수를 출력하라. 이때 awdawdaw001203adw 을 입력하면 1203 이 출력된다. 즉 첫 자리 0은 자연수화 할때 무시한다 입력예제1 gaww0012as 출력예제1 12 입력예제2 awkjd120000k 출력예제2 120000 입력예제3 awkj0aa1200020sa 출력예제3 1200020 #include using namespace std; int main() { char arr[50] = { 0 }; int result[50] = { 0 }; int num = 0; cin >> arr; for (int i = 0; i < 50; i++) { int change = (int)arr[i];..
-
주민등록번호algorism 2020. 1. 2. 14:08
민증의 주민번호가 주어지면 주민번호로 주인의 나이와 성별을 판단하여 출력하는 프로그램을 작성하라 주민번호의 번호는 - 를 기준으로 앞자리 뒷자리로 나뉜다. 뒷자리 첫 번짜 수가 1이면 1900년대생 남자,2면 1900년대생 여자 ,3이면 2000년대생 남자,4이면 2000년대생 여자이다. 입력예제1 790316-2365452 출력예제1 42 W 입력예제2 061010-3575326 출력예제2 14 M #include #include using namespace std; int change(char a) { int change; change = (a - 48); return change; } int main(void) { int gender; int age; char a[20]; cin >> a; gend..
-
bfs - 알고리즘algorism 2019. 12. 29. 21:04
bfs - 알고리즘 너비 우선 탐색 알고리즘 위 트리를 vector함수로 구현한다 vector a[10]; int main(void) { a[1].push_back(2); a[2].push_back(1); a[1].push_back(3); a[3].push_back(1); a[2].push_back(4); a[4].push_back(2); a[2].push_back(5); a[5].push_back(2); a[4].push_back(8); a[8].push_back(4); a[5].push_back(9); a[9].push_back(5); a[3].push_back(6); a[6].push_back(3); a[3].push_back(7); a[7].push_back(3); return 0; } #incl..
-
dll lib차이면접대비 2019. 12. 29. 14:43
정적라이브러리(static link library).lib 컴파일 시에 함수가 실행파일에 연결된다. 실행 파일에 함수의 코드가 복사되기 때문에 실행파일의 크기가 커지는 단점이 있지만 실행 파일은 완전한 단독 실행 파일이 된다. 실행파일에 함수의 코드가 포함되어 있기 때문에 컴파일이 끝나면 lib 파일이 없어도 프로그램을 실행 할 수있다. 컴파일할 때 같이 링크 동적라이브러리(dynamic link library).dll 정적라이브러리처럼 컴파일 시에 함수가 연결되는 방식이 아닌 런타임시에 함수가 실행파일에 연결된다. 실행파일에는 호출할 함수의 정보만 포함되고 실제 함수 코드는 복사되지 않으므로 실행 파일의 크기가 작아진다. 하지만 실행 파일은 함수에 대한 정보만 가지고 있을 뿐 실제 코드를 가지고 있지 ..
-
기억장치면접대비 2019. 12. 29. 14:35
ram 전원이 끊어지면 기억되어있는 데이터들이 소멸되기 때문에 휘발성 메모리라고 표현함 데이터를 읽는 속도와 기록하는 속도가같으며 컴퓨터의 주기억장치, 응용 프로그램 로딩,데이터 일시 저장등과 같은곳에 사용됨 rom 전원이 끊어져도 기록된 데이터들이 소멸되지 않는 비휘발성 메모리 즉 rom에 데이터를 반영구적으로 저장한 후 이를 지속적으로 사용하게 됨 ram rom차이 ram 읽기 쓰기 가능 rom 읽기만 가능 ram 빠르다 rom 비교적 느림 ram 휘발성 메모리 rom 비 휘발성 메모리 캐쉬메모리 로그램 실행중 cpu가 필요로 하는 데이터가 레지스터에 없는 경우 주기억장치로 부터 읽어오기 위해서는 상당히 긴시간을 기다려야한다, 특히 대규모 컴퓨터 시스템에서와 같이 cpu와 주기억장치가 서로 다른 보드..