분류 전체보기(99)
-
프로그램 MIPS, ARM, ISA
운영체제는 사용자 프로그램과 하드웨어 사이의 인터페이스 역할을 한다. 그렇다면 사용자의 명령어는 어떤 방식으로 CPU에 의해 실행되는 걸까? 사용자의 명령어는 (C, JAVA) 컴파일러에 의해 어셈블리 언어로 번역이 된다. 어셈블리 언어는 프로세서의 ISA에 specific하다는 특징을 갖는다. ISA는 프로세서가 실행할 수 있는 명령어 집합이다. 프로세서가 실행할 수 있는 작업들이나, 데이터 타입 같은 것들을 의미한다. RISC, CISC 는 ISA의 종류이다. ARM과 MIPS는 대표적인 RISC 아키텍처의 종류이다. 컴파일러에 따라 결과물인 어셈블리 언어가 다르다. ISA에는 앞서 설명했듯이 RISC와 CISC가 있다. CISC는 Complex Instruction Set Computer 이다. 즉..
2023.11.05 -
프로그래머스 등굣길 dp c++ 디버깅
코드 #include #include #define DIV using namespace std; int arr[101][101]; long long dp[101][101]; #define DIV 1000000007 int solution(int m, int n, vector puddles) { int answer = 0; // 물 표시 for (int i = 0;i < puddles.size();i++) { int x = puddles[i][0], y = puddles[i][1]; arr[y - 1][x - 1] = -1; dp[y - 1][x - 1] = 0; } if (arr[0][0] != -1) { dp[0][0] = 1; } for (int i = 1;i < n;i++) { if (arr[i][..
2023.10.26 -
프로그래머스 연속 펄스 부분 수열의 합 c++
#include #include #include using namespace std; long long plusDp[500001]; long long minusDp[500001]; long long solution(vector sequence) { long long answer = 0; vector plusSequence, minusSequence; // 펄스 수열 두가지를 곱해서 두개의 수열을 만들었다 for (int i=0;i
2023.10.26 -
프로그래머스 타겟넘버 c++
#include #include using namespace std; int Target; int Answer; vector Numbers; void dfs(int cnt, int curr) { if (cnt >= Numbers.size()) { if (curr == Target) { Answer++; } return; } dfs(cnt + 1, curr + Numbers[cnt]); dfs(cnt + 1, curr - Numbers[cnt]); } int solution(vector numbers, int target) { int answer = 0; Target = target; Numbers = numbers; dfs(0, 0); answer = Answer; return answer; } int ..
2023.10.26 -
프로그래머스 가장 먼 노드 c++ 그래프 탐색
#include #include #include #include #include using namespace std; int N, max_n; vector v[50001]; int visited[500001]; int solution(int n, vector edge) { N=n; int answer = 0; for (int i=0;i
2023.10.25 -
프로그래머스 베스트 앨범 c++ map
vector answer; map m; map M; for (int i = 0;i < genres.size();i++) { m[genres[i]] += plays[i]; } for (auto it : m) { M[it.second] = it.first; } M 이라고 선언한 map에 많이 재생된 순서로 노래를 정렬했다. Map은 key 값을 기반으로 정렬이 되므로 key로 정렬한 후에 벡터로 담아서 다시 정렬을 해야한다. 이때 정렬을 위한 boolean 함수를 작성했다. #include #include #include #include #include using namespace std; bool cmp(pair a, pair b) { if (a.first != b.first) { return a.firs..
2023.10.25