그럴듯한 개발 블로그
프로그래머스 여행경로 c++

https://school.programmers.co.kr/learn/courses/30/lessons/43164 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 보자마자 또 문제 잘못보고 map으로 풀었다. 아차차 다시 ICN왔다갔다 할 수 있다. #include // 실패코드 #include #include using namespace std; vector solution(vector tickets) { vector answer; unordered_map m; for (int i = 0; i < tickets.size(); i++) m[tickets[i..

프로그래머스 등굣길 c++

https://school.programmers.co.kr/learn/courses/30/lessons/42898 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 아오 이거 왜 물웅덩이 x y 순서 거꾸로인지 헷갈리게 이러지마제발 #include #include #include using namespace std; int solution(int row, int col, vector puddles) { int answer = 0; // row 가로 col 세로 vector board(col, vector(row, 0)); board[0][0] = 1; for..

백준 20310 타노스 c++
<algorithm>/백준 2023. 10. 24. 01:52

https://www.acmicpc.net/problem/20310 20310번: 타노스 어느 날, 타노스는 0과 1로 이루어진 문자열 $S$를 보았다. 신기하게도, $S$가 포함하는 0의 개수와 $S$가 포함하는 1의 개수는 모두 짝수라고 한다. 갑자기 심술이 난 타노스는 $S$를 구성하는 문자 www.acmicpc.net 아놔 중간에 연속된 사전적으로 제일 빠른 문자열 찾는줄알고 시간 낭비 오지게 했다. 그냥 말 그대로 뽑는거다 연속된거 아님 #include #include using namespacestd; intmain() { ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); string s; cin >> s; int half_zero_cnt, half_one_..

백준 1911 흙길 보수하기 c++
<algorithm>/백준 2023. 10. 14. 16:16

https://www.acmicpc.net/problem/1911 1911번: 흙길 보수하기 어젯밤 겨울 캠프 장소에서 월드 본원까지 이어지는, 흙으로 된 비밀길 위에 폭우가 내려서 N(1 ≤ N ≤ 10,000)개의 물웅덩이가 생겼다. 월드학원은 물웅덩이를 덮을 수 있는 길이가 L(1 ≤ L ≤ 1,000 www.acmicpc.net 이미 막힌 웅덩이일 경우만 생각해주면 어렵지 않은 문제이다. #include #include #include #include using namespacestd; intmain() { ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); int M, woodLen, res = 0; vector v; cin >> M >> woodLen; for..

백준 1459 걷기 c++
<algorithm>/백준 2023. 10. 12. 16:13

https://www.acmicpc.net/problem/1459 1459번: 걷기 세준이는 학교에서 집으로 가려고 한다. 도시의 크기는 무한대이고, 도시의 세로 도로는 모든 정수 x좌표마다 있고, 가로 도로는 모든 정수 y좌표마다 있다. 세준이는 현재 (0, 0)에 있다. 그리고 ( www.acmicpc.net 어디서 비슷한 문제 풀었던거 같은데 아마 프로그래머스인가보다. #include #include #include #include using namespacestd; long long X, Y, line, cross, res = 0; intmain() { ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); cin >> X >> Y >> line >> cross; i..

백준 2879 코딩은 예쁘게 c++
<algorithm>/백준 2023. 10. 9. 17:08

https://www.acmicpc.net/problem/2879 2879번: 코딩은 예쁘게 첫째 줄에 줄의 개수 N(1 ≤ N ≤ 1,000)이 주어진다. 둘째 줄에는 현재 줄에 있는 탭의 개수가 주어지며, 1번째 줄부터 순서대로 주어진다. 탭의 개수는 0보다 크거나 같고, 80보다 작거나 같은 정수 www.acmicpc.net start부터 drag까지 1씩 뺐을때, 더했을때 비교해서 매 순간 제일 효율적인 상황으로 간다. #include // 실패코드 #include #include #include #include #include #include #include using namespacestd; vector src, dst; int res = 0, num; bool isOk() { for (int..