전체 글
-
[Programmers][C++]체육복Algorithm 2022. 8. 19. 13:48
https://school.programmers.co.kr/learn/courses/30/lessons/42862 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr lost와 reserve를 문자열로 배열을 받고 그것을 vector에 push 해줘야 한다. 문자열을 받아서 숫자인지 확인하는 방법 if (lost_arr[i] != ',') { lost.push_back(lost_arr[i]); } 여분이 있는 학생한테 옷을 빌리면 그 학생은 더 이상 옷을 빌려줄 수 없으므로 여분이 있는 학생에서 제외해야한다. erase(remove(v.begin(),v.end..
-
[BOJ][C++] 2473 새 용액Algorithm 2022. 7. 11. 03:05
https://www.acmicpc.net/problem/2473 #include #include #include #include using namespace std; int n; int main() { //iostream과 stdio 버퍼 동기화시켜서 입력 빨리받아오자 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //============================================== cin>>n; vector liquids(n,0); for(int i = 0; i>liquids[i]; } sort(liquids.begin(), liquids.end()); //a,b용액을 이중포문으로 찾고, 마지막 c는 lower_b..
-
[BOJ][C++]9019 DSLRAlgorithm 2022. 7. 11. 03:00
https://www.acmicpc.net/problem/9019 9019번: DSLR 네 개의 명령어 D, S, L, R 을 이용하는 간단한 계산기가 있다. 이 계산기에는 레지스터가 하나 있는데, 이 레지스터에는 0 이상 10,000 미만의 십진수를 저장할 수 있다. 각 명령어는 이 레지스터에 www.acmicpc.net #include #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int T; cin >> T; while (T--) { string p; cin >> p; int n; cin >> n; string arr; cin >> arr; deque d..
-
[BOJ] [C++] ACAlgorithm 2022. 7. 11. 02:56
https://www.acmicpc.net/problem/5430 5430번: AC 각 테스트 케이스에 대해서, 입력으로 주어진 정수 배열에 함수를 수행한 결과를 출력한다. 만약, 에러가 발생한 경우에는 error를 출력한다. www.acmicpc.net #include #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int T; cin >> T; while (T--) { string p; cin >> p; int n; cin >> n; string arr; cin >> arr; deque dq; bool isReversed = false; bool isErro..
-
[BOJ][C++]16235 나무 제테크Algorithm 2022. 7. 3. 22:47
https://www.acmicpc.net/problem/16235 #include #include #include #include #include using namespace std; int n, m, k; int a[11][11]; int nutri[11][11]; deque trees[11][11]; int dx[] = {-1, -1, 0, 1, 1, 1, 0, -1}; int dy[] = {0, 1, 1, 1, 0, -1, -1, -1}; int main() { scanf("%d %d %d", &n, &m, &k); for(int i = 1; i
-
[BOJ][C++] 13549 숨바꼭질 3카테고리 없음 2022. 7. 3. 22:44
https://www.acmicpc.net/problem/13549 13549번: 숨바꼭질 3 수빈이는 동생과 숨바꼭질을 하고 있다. 수빈이는 현재 점 N(0 ≤ N ≤ 100,000)에 있고, 동생은 점 K(0 ≤ K ≤ 100,000)에 있다. 수빈이는 걷거나 순간이동을 할 수 있다. 만약, 수빈이의 위치가 X일 www.acmicpc.net #include #include #include #include // memset using namespace std; #define MAX_SIZE 100000+1 int N, K; int visited[MAX_SIZE]; int bfs() { deque dq; dq.push_back(N); visited[N] = 1; while (!dq.empty()) { /..
-
[BOJ][C++] 3197 백조의 호수카테고리 없음 2022. 6. 26. 23:52
https://www.acmicpc.net/problem/3197 3197번: 백조의 호수 입력의 첫째 줄에는 R과 C가 주어진다. 단, 1 ≤ R, C ≤ 1500. 다음 R개의 줄에는 각각 길이 C의 문자열이 하나씩 주어진다. '.'은 물 공간, 'X'는 빙판 공간, 'L'은 백조가 있는 공간으로 나타낸다. www.acmicpc.net 코드 #include #include #include using namespace std; struct Que { int x; int y; }; char board[1501][1501]; bool vis[1501][1501]; int dx[4] = { 0,1,0,-1 }; int dy[4] = { 1,0,-1,0 }; int main() { int R, C; int l..