본문 바로가기

알고리즘/프로그래머스12

[프로그래머스] MySQL - JOIN 없어진 기록 찾기 MySQL 언어를 이용하여 해결하였다. JOIN 문법에 대한 게시글을 본다면 도움이 될 것이다. 1. Solution SELECT OUTS.ANIMAL_ID, OUTS.NAME FROM ANIMAL_OUTS AS OUTS LEFT JOIN ANIMAL_INS AS INS ON OUTS.ANIMAL_ID = INS.ANIMAL_ID WHERE INS.ANIMAL_ID IS NULL ORDER BY OUTS.ANIMAL_ID; 2022. 4. 9.
[프로그래머스] 완전탐색 - 모의고사 C++로 해결하였다. 1. Solution #include #include #include using namespace std; int stu1[5] = {1, 2, 3, 4, 5}; int stu2[8] = {2, 1, 2, 3, 2, 4, 2, 5}; int stu3[10] = {3, 3, 1, 1, 2, 2, 4, 4, 5, 5}; vector solution(vector answers) { vector answer; int score[3]; fill(score, score + 3, 0); // 문제 체점 for(int i = 0; i < answers.size(); i++){ if(answers[i] == stu1[i % 5]) score[0] += 1; if(answers[i] == stu2[i.. 2022. 4. 3.
[KaKao 기출] 직사각형 좌표 값 구하기 #kakao #코딩테스트 비트 연산자(XOR)을 사용하면 간결하게 작성되는 문제이다. 1. Solution #include #include using namespace std; int x, y; vector solution(vector v) { vector ans; x = v[0][0]^v[1][0]^v[2][0]; y = v[0][1]^v[1][1]^v[2][1]; ans.push_back(x); ans.push_back(y); return ans; } 2. 비트 연산자 XOR 연산 (^): 연산을 수행하는 두 값이 같으면 같은 값을, 다르면 다른 값을 반환한다. A B A^B 1 1 0 1 0 1 0 1 1 0 0 0 AND 연산 (&): 연산을 수행하는 두 값 모두 True 이여야만 True로 평가.. 2022. 3. 11.
프로그래머스(11일 이내 해결예정) - C++ 124 나라의 숫자 단순 구현문제이다. 1. Solution 코드 2. 알아야 할 개념 2021. 10. 11.