'알고리즘 최종 (단계별)/0.init' 카테고리의 글 목록
본문 바로가기
728x90
반응형

알고리즘 최종 (단계별)/0.init4

9935_문자열폭발 기본적으로 생각할 수 있는 방법 #include #include #include #include using namespace std; int main(void) { string inputString; string bombString; cin >> inputString; cin >> bombString; while (1) { int index = inputString.find(bombString); if (index == -1)break; inputString.erase(inputString.begin()+index, inputString.begin() + index + bombString.length()); } if (inputString == "") cout b; int n = strlen(a); in.. 2023. 6. 20.
1236_성지키기 문제 링크 https://www.acmicpc.net/problem/1236 문제 분석 모든 행과 모든 열에 한명 이상의 경비원 있으면 좋겠음 x는 경비원이 있는 칸 문제 해결 과정 x가 없는 행과 열에서 경비원이 한명이라도 없는 것에서 큰값을 구한다면 그것이 답이됨 소스 코드 #include #include using namespace std; int rowDirection(char board[54][54], int y, int x) { int cnt = 0; for (int i = 0; i < y; i++) { int xCheck = 0; for (int j = 0; j < x; j++) { if (board[i][j] == 'X') { xCheck = -1; break; } } if (xCheck .. 2023. 6. 16.
1181_단어정렬 문제 링크 https://www.acmicpc.net/problem/1181 문제 설명 알파벳 소문자로 이루어진 N개의 단어를 조건에 따라서 정렬하는 프로그램을 만드는것 길이가 짧은것 부터, 같은 경우 사전 순정렬 중복 없이 중복제거 하는 경우 소스코드 #include #include #include #include using namespace std; bool cmp(const string &u, const string &v) { if (u.size() == v.size()) { return u > N; vector words(N); for (int i = 0; i < N; i.. 2023. 6. 12.
백준 1076 저항 문제 링크 https://www.acmicpc.net/problem/1076 문제 풀이 소스 코드 #include #include #include #include using namespace std; int main(void) { //map res; //res["black"] = 1; //res["brown"] = 10; //res["red"] = 100; //res["orange"] = 1000; //res["yellow"] = 10000; //res["green"] = 100000; //res["blue"] = 1000000; //res["violet"] = 10000000; //res["grey"] = 100000000; //res["white"] = 1000000000; map res = { {".. 2023. 6. 11.
728x90
반응형