전체 글
-
[백준] 미세먼지 안녕!Study/Coding Test 2021. 10. 11. 12:11
https://www.acmicpc.net/problem/17144 17144번: 미세먼지 안녕! 미세먼지를 제거하기 위해 구사과는 공기청정기를 설치하려고 한다. 공기청정기의 성능을 테스트하기 위해 구사과는 집을 크기가 R×C인 격자판으로 나타냈고, 1×1 크기의 칸으로 나눴다. 구사 www.acmicpc.net 단순히 구현하는 문제였다. #define _CRT_SECURE_NO_DEPRECATE #include #include #include #include #include using namespace std; int arr[51][51]; int temp[51][51]; int R, C, T; int dr[4] = { 0,0,-1,1 }; int dc[4] = { 1,-1,0,0 }; bool inR..
-
[2018 1차 KAKAO] 뉴스 클러스터링Study/Coding Test 2021. 10. 10. 14:53
https://programmers.co.kr/learn/courses/30/lessons/17677 코딩테스트 연습 - [1차] 뉴스 클러스터링 뉴스 클러스터링 여러 언론사에서 쏟아지는 뉴스, 특히 속보성 뉴스를 보면 비슷비슷한 제목의 기사가 많아 정작 필요한 기사를 찾기가 어렵다. Daum 뉴스의 개발 업무를 맡게 된 신입사원 튜브 programmers.co.kr 벡터의 집합 연산 (합집합, 교집합)이 필요했던 문제. #include #include #include #include using namespace std; bool isAlphabet(char c){ return (c>='a' && c='A' && c
-
[2018 1차 KAKAO] 셔틀버스Study/Coding Test 2021. 10. 8. 22:47
https://programmers.co.kr/learn/courses/30/lessons/17678# 코딩테스트 연습 - [1차] 셔틀버스 10 60 45 ["23:59","23:59", "23:59", "23:59", "23:59", "23:59", "23:59", "23:59", "23:59", "23:59", "23:59", "23:59", "23:59", "23:59", "23:59", "23:59"] "18:00" programmers.co.kr SOL) 복잡하게 생각해서 풀이가 어려웠다. 단순히 두가지 경우의 수만 생각하자. 1. 마지막 셔틀에 자리가 있는 경우 2. 마지막 셔틀에 자리가 없는 경우 1번의 경우에는 마지막 셔틀이 오는 시간에 타면 되고 2번의 경우에는 마지막으로 탄 크루보다 ..
-
[2018 1차 KAKAO] 다트 게임Study/Coding Test 2021. 10. 7. 23:25
https://programmers.co.kr/learn/courses/30/lessons/17682 코딩테스트 연습 - [1차] 다트 게임 programmers.co.kr #include #include #include #include using namespace std; int solution(string dartResult) { int answer = 0; vector v; int idx=0; int v_idx = -1; int score; char bonus, option; while(idx ='0' && dartResult[idx] 0) v[v_idx-1] *=2; } else if(dartResult[idx] == '#'..
-
[2018 1차 KAKAO] 비밀지도Study/Coding Test 2021. 10. 7. 19:49
https://programmers.co.kr/learn/courses/30/lessons/17681 코딩테스트 연습 - [1차] 비밀지도 비밀지도 네오는 평소 프로도가 비상금을 숨겨놓는 장소를 알려줄 비밀지도를 손에 넣었다. 그런데 이 비밀지도는 숫자로 암호화되어 있어 위치를 확인하기 위해서는 암호를 해독해야 한다. 다 programmers.co.kr SOL) 1. arr1과 arr2의 OR 계산하기 2. 자리수가 n과 맞는지 확인 #include #include #include using namespace std; vector solution(int n, vector arr1, vector arr2) { vector answer; for(int i=0; i0){ if(temp%2 == 1) str =..
-
[2020 KAKAO] 자물쇠와 열쇠Study/Coding Test 2021. 10. 5. 18:46
https://programmers.co.kr/learn/courses/30/lessons/60059 코딩테스트 연습 - 자물쇠와 열쇠 [[0, 0, 0], [1, 0, 0], [0, 1, 1]] [[1, 1, 1], [1, 1, 0], [1, 0, 1]] true programmers.co.kr SOL) 1. key가 전체 lock에 한칸 겹칠수 있는 크기의 array를 -1로 초기화 2. lock의 홈 개수 파악 및 lock 표시 3. key의 돌기와 lock의 홈이 만나는지 체크 3-1. key의 돌기와 lock의 돌기가 만나는 경우, 해당 위치에서 break; 3-2. lock의 모든 홈에 대해 맞으면 true 반환 3-3. 열쇠를 돌려가며 반복 (4방향) #include #include #inc..
-
[2019 KAKAO] 실패율Study/Coding Test 2021. 10. 3. 12:29
https://programmers.co.kr/learn/courses/30/lessons/42889# 코딩테스트 연습 - 실패율 실패율 슈퍼 게임 개발자 오렐리는 큰 고민에 빠졌다. 그녀가 만든 프랜즈 오천성이 대성공을 거뒀지만, 요즘 신규 사용자의 수가 급감한 것이다. 원인은 신규 사용자와 기존 사용자 사이에 스 programmers.co.kr #include #include #include #include using namespace std; bool comp(pair p1, pair p2){ if(p1.second == p2.second){ return p1.first p2.second; } } vector solution(in..