| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
- UNIX
- baekjoon
- Vivado
- 실기
- AMBA BUS
- Bus
- SQL
- chip2chip
- boj
- HDLBits
- 정보처리기사
- Beakjoon
- 코딩테스트
- linux
- verilog HDL
- vitis
- hdl
- C++
- Backjoon
- 백준
- Zynq
- axi
- FPGA
- amba
- Xilinx
- 리눅스
- verilog
- 정처기
- java
- 자격증
- Today
- Total
목록PS (65)
Hueestory
접근1. 시계방향으로 이동 중 배열의 끝에 닿거나 다음으로 이동할 칸에 이미 0이 아닌 값이 들어가 있으면 방향 전환2. 방향 전환은 x(행), y(열)로 접근3. (dx, dy)에서 →(0, 1), ↓(1, 0), ←(0,-1), ↑(-1, 0)4. 이를 dx와 dy로 나누면 dx = [0, 1, 0, -1], dy = [1, 0, -1, 0] 코드def solution(n): answer = [[0] * n for _ in range(n)] x, y = 0, 0 dir = 0 # 0(→), 1(↓), 2(←), 3(↑) dx = [0, 1, 0, -1] dy = [1, 0, -1, 0] for i in range(1, n**2+1): answ..
스택- LIFO, DFS- 삽입(push)과 삭제(pop)이 top에서만 일어남 큐- FIFO, BFS- 가장 먼저 들어온 데이터는 front, 가장 늦게 들어온 데이터는 back- 삽입(push)은 back에서, 삭제(pop)는 front에서 일어남 버블 정렬1. 두 인접 데이터의 크기를 비교해 정렬(swap)2. 개수가 N개 일 때 정렬된 영역 설정을 위해 j for(int i = 0; i 선택 정렬1. 최솟값 또는 최댓값을 찾아 가장 앞 데이터와 swap2. index++, index가 전체 데이터 크기 이상이 되면 종료 삽입 정렬1. 데이터 값을 선택하여, 정렬된 데이터 범위에 삽입될 위치를 탐색2. 삽입 위치부터 index까지 shift3. 데이터를 삽입하고 index++, index가 전체 ..
#include #include #include using namespace std;vector solution(vector record) { vector answer; map m1; vector> tmp; for (auto x : record){ int a = x.find(" "); int b = x.find(" ", a + 1); string ioc = x.substr(0, a); string uid = x.substr(a + 1, b - a - 1); if (ioc == "Enter"){ string name = x.substr(b + 1); m1[uid..
#include #include #include #include using namespace std;vector solution(vector fees, vector records) { vector answer; map tmp, cnt; for (auto s : records){ int time = stoi(s.substr(0, 2)) * 60 + stoi(s.substr(3, 2)); int car_num = stoi(s.substr(6, 4)); if (s.substr(11) == "IN") tmp[car_num] = time; else{ cnt[car_num] += time - tmp[car_num]; ..
#include #include #include #include using namespace std;string solution(string new_id) { // 1단계 transform (new_id.begin(), new_id.end(), new_id.begin(), ::tolower); // 2단계 string tmp = ""; for (auto x : new_id){ if (isalpha(x) || isdigit(x) || x == '-' || x == '_' || x == '.') tmp += x; } new_id = tmp; tmp = ""; // 3단계 for (auto x : new..
bool isPrime(long long num){ if (num 다양한 응용이 가능하니 꼭 외워놓기
#include #include #include #include #include using namespace std;bool isPrime(long long num){ if (num 0){ s += to_string(n % k); n /= k; } reverse(s.begin(), s.end()); string tmp = ""; for(char x : s){ if(x == '0'){ if(!tmp.empty() && isPrime(stoll(tmp))) answer++; tmp = ""; } else tmp += x; } i..