전체 글
-
백준 1463번: 1로 만들기다이나믹프로그래밍(DP) 2018. 8. 9. 13:29
https://www.acmicpc.net/problem/1463 1. 문제 2. 알고리즘키워드 - 다이나믹프로그래밍, 메모제이션 3. 코드 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define MAX_SIZE 100#define INF 0x7fffffff#define CEN..
-
Level 1> 서울에서 김서방 찾기프로그래머스(Programmers) 2018. 8. 8. 16:29
https://programmers.co.kr/learn/courses/30/lessons/12919 1. 문제 2. 알고리즘키워드 - 구현, 문자열 3. 코드 1234567891011121314151617181920212223#include #include using namespace std; string solution(vector seoul) { string answer = ""; const int size = seoul.size(); int cand = 0; for(int i=0; i
-
Level 1 > 문자열 다루기 기본프로그래머스(Programmers) 2018. 8. 8. 16:24
https://programmers.co.kr/learn/courses/30/lessons/12918 1. 문제 2. 알고리즘키워드 - 구현, 문자열 3. 코드 123456789101112131415161718192021222324#include #include using namespace std; bool solution(string s) { bool answer = false; const int size = s.size(); if(size == 4 || size == 6) { for(int i=0; i= '0' && s[i]
-
Level 1 > 문자열 내림차순으로 배치하기프로그래머스(Programmers) 2018. 8. 8. 15:41
https://programmers.co.kr/learn/courses/30/lessons/12917 1. 문제 2. 알고리즘키워드 - 구현, 정렬 3. 코드 1234567891011#include #include #include #include using namespace std; string solution(string s) { sort(s.begin(), s.end(), greater()); return s;}Colored by Color Scriptercs
-
Level 1> 문자열 내 p와 y의 개수프로그래머스(Programmers) 2018. 8. 8. 15:07
https://programmers.co.kr/learn/courses/30/lessons/12916 1. 문제 2. 알고리즘키워드 - 구현, 문자열 3. 코드 123456789101112131415161718192021222324252627282930#include #include #include #include using namespace std; bool solution(string s){ bool answer = true; const int size = s.size(); int count_p = 0; int count_y = 0; transform(s.begin(), s.end(), s.begin(), ::tolower); for(int i=0; i
-
Level 1 > 나누어 떨어지는 숫자 배열프로그래머스(Programmers) 2018. 8. 8. 15:05
https://programmers.co.kr/learn/courses/30/lessons/12910 1. 문제 2. 알고리즘키워드 - 구현, 배열 3. 코드 12345678910111213141516171819202122#include #include #include using namespace std; vector solution(vector arr, int divisor) { vector answer; sort(arr.begin(), arr.end()); const int size = arr.size(); for(int i=0; i
-
프로그래머스 > Level 1 > 가운데 글자 가져오기프로그래머스(Programmers) 2018. 8. 8. 14:58
https://programmers.co.kr/learn/courses/30/lessons/12903?language=cpp 1. 문제 2. 알고리즘키워드 - 문자열 3. 코드 12345678910111213141516171819#include #include using namespace std; string solution(string s) { string answer = ""; const int size = s.size(); int cand = size / 2; if(size % 2 == 0) { answer.push_back(s[cand-1]); answer.push_back(s[cand]); } else { answer.push_back(s[cand]); } return answer;}Colore..