목록Problem Solving (223)
Life Engineering
https://www.acmicpc.net/problem/14500 14500번: 테트로미노 폴리오미노란 크기가 1×1인 정사각형을 여러 개 이어서 붙인 도형이며, 다음과 같은 조건을 만족해야 한다. 정사각형은 서로 겹치면 안 된다. 도형은 모두 연결되어 있어야 한다. 정사각형의 변 www.acmicpc.net #include #include #include #include #include using namespace std; int dx[4]={-1,1,0,0}; int dy[4]={0,0,-1,1}; int graph[500][500]; struct mino{ int sum; int cnt; int py, px; int y,x; }; int bfs(int y, int x, int N, int M){ ..
https://www.acmicpc.net/problem/13460 13460번: 구슬 탈출 2 첫 번째 줄에는 보드의 세로, 가로 크기를 의미하는 두 정수 N, M (3 ≤ N, M ≤ 10)이 주어진다. 다음 N개의 줄에 보드의 모양을 나타내는 길이 M의 문자열이 주어진다. 이 문자열은 '.', '#', 'O', 'R', 'B' www.acmicpc.net #include #include #include #include #include using namespace std; int dy[4] = { -1,1,0,0 }; int dx[4] = { 0,0,-1,1 }; string graph[10]; bool visited[10][10][10][10]; class Info { public: int ry, ..
https://www.acmicpc.net/problem/14503 14503번: 로봇 청소기 로봇 청소기가 주어졌을 때, 청소하는 영역의 개수를 구하는 프로그램을 작성하시오. 로봇 청소기가 있는 장소는 N×M 크기의 직사각형으로 나타낼 수 있으며, 1×1크기의 정사각형 칸으로 나누어 www.acmicpc.net #include #include #include #include #include #include using namespace std; int dx[4] = { -1,1,0,0 }; int dy[4] = { 0,0,-1,1 }; int graph[50][50]; bool visited[50][50]; class Info { public: int r; int c; int d; Info(int r, ..
https://programmers.co.kr/learn/courses/30/lessons/60058 코딩테스트 연습 - 괄호 변환 카카오에 신입 개발자로 입사한 "콘"은 선배 개발자로부터 개발역량 강화를 위해 다른 개발자가 작성한 소스 코드를 분석하여 문제점을 발견하고 수정하라는 업무 과제를 받았습니다. 소스를 programmers.co.kr #include #include #include using namespace std; bool isCorrect(string p){ stack s; for (char c: p){ if (c=='(') s.push(c); else{ if (s.empty()) return false; else s.pop(); } } return true; } string conver..