목록전체 글 (370)
cgy12306
// https://www.acmicpc.net/problem/14503 // 로봇 청소기 #include using namespace std; int map[51][51]; bool visited[51][51]; int r, c, x, y, dir; int dx[] = {0, -1, 0, 1}; int dy[] = {-1, 0, 1, 0}; int cnt = 0; void clear(int x, int y) { visited[x][y] = true; map[x][y] = 2; cnt++; } bool turn_go() { int nx = x + dx[dir]; int ny = y + dy[dir]; //cout > y >> dir; for (int i = 0; i < r; i++) { for (int ..
// https://www.acmicpc.net/problem/20055 // 컨베이어 벨트 위의 로봇 #include #include using namespace std; int N, K, belt[201]; bool robot[201]; void curl() { int tmp1, tmp2; tmp1 = belt[2 * N]; tmp2 = robot[2 * N]; for (int i = N * 2 ; i > 1; i--) { belt[i] = belt[i - 1]; robot[i] = robot[i - 1]; } belt[1] = tmp1; robot[1] = tmp2; robot[N] = false; } void move() { for (int i = N - 1; i > 0 ; i--) { if (!..
// https://www.acmicpc.net/problem/2947 // 나무조각 #include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int wood[6]; for (int i = 0; i > wood[i]; } for (int k = 0; k wood[i + 1]) { swap(wood[i], wood[i + 1]); for (int j = 0; j < 5; j++) { cout
// https://www.acmicpc.net/problem/17070 // 파이프 옮기기1 #include using namespace std; int N, cnt; int map[17][17]; int dx[] = { 0, 1, 1 }; int dy[] = { 1, 1, 0 }; // 가로 1, 대각 2, 가로 3 bool check(int x, int y, int dir) { int nx = x + dx[dir]; int ny = y + dy[dir]; if (nx >= N || ny >= N || map[nx][ny] == 1) return false; if (dir == 0) { if (map[x][y+1] == 1) return false; } else if (dir == 1) { for (..
# https://www.acmicpc.net/problem/16918 # 봄버맨 import copy def print_map(): for i in range(n): for j in range(m): if TimeMap[i][j] == 0: print('.', end='') else: print('O', end='') print() def set_bomb(): for i in range(n): for j in range(m): if Map[i][j] == '.': TimeMap[i][j] = 0 else: TimeMap[i][j] = 2 def flow_time(): for i in range(n): for j in range(m): if TimeMap[i][j] == 0: TimeMap[i][j] =..
# https://www.acmicpc.net/problem/1094 # 막대기 data = int(input()) cnt = 0 while data > 0: if data % 2 != 0: cnt += 1 data = data//2 print(cnt)
#https://www.acmicpc.net/problem/9935 #문자열폭발 import sys s = sys.stdin.readline()[:-1] bomb = sys.stdin.readline()[:-1] stack = [] for ch in s: stack.append(ch) if stack[-1] == bomb[-1] and "".join(stack[-len(bomb):]) == bomb: del stack[-len(bomb):] answer = "".join(stack) if answer == "": print("FRULA") else: print(answer)
#include #include #include #include using namespace std; vector solution(vector progresses, vector speeds) { vector answer; queue q; for(int i=0;i
// https://www.acmicpc.net/problem/5052 // 전화번호 목록 #include #include #include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int T, N; cin >> T; for (int t = 0; t > N; vector v; bool flag = false; for (int n = 0; n > s; v.push_back(s); } sort(v.begin(), v.end()); for (int i = 0; i < v.size() - 1; i++) {..
// https://acmicpc.net/problem/10546 // 배부른 마라토너 #include #include #include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); vector participant; vector completion; unordered_map um; string answer = ""; int N; cin >> N; for (int i = 0; i > s; participant.push_back(s); } for (int i = 0; i < N - 1; i++) { string s; cin..