Algorithm(218)
-
[BOJ] 14891번 : 톱니바퀴
1. problem : https://www.acmicpc.net/problem/14891 2. solution 1 :#include using namespace std;string board[4];int K; // Test case의 수 deque dq1;deque dq2;deque dq3;deque dq4;void rotate(int w,deque& dq) { if (w == 1) { dq.push_front(dq.back()); dq.pop_back(); } if (w == -1) { dq.push_back(dq.front()); dq.pop_front(); }}int main(void) { ios::sync_with_stdio(0); cin.tie(0); for (int i = 0; i ..
2024.08.21 -
[BOJ] 11559번 : Puyo Puyo
1. problem : https://www.acmicpc.net/problem/11559 2. solution 1 :// source code 출처 : https://github.com/encrypted-def/basic-algo-lecture/blob/master/0x0D/solutions/11559.cpp#include using namespace std; bool ispuyo; bool vis[12][6];string board[12]; int dx[4] = { 1,0,-1,0 };int dy[4] = { 0,1,0,-1 }; int ans;void resetvis() { for (int i = 0; i > trash; queue> Q; vis[x][y] = true; char color =..
2024.08.21 -
[BOJ] 15686번 : 치킨 배달
1. problem : https://www.acmicpc.net/problem/15686 2. solution 1 :#include using namespace std;#define X first#define Y second int n, m;int board[52][52]; vector> house;vector> all_chicken;vector> cho_chicken;bool isUsed[15];int mn_dist = 15000; void chickenDist(int cnt, int target_cnt) { if (target_cnt == cnt) { int dist_sum = 0; for (int i = 0; i > n >> m; for (int i = 0; i > board[i][j]; ..
2024.08.20 -
[BOJ] 12100번 : 2048 (Easy)
1. problem :https://www.acmicpc.net/problem/12100 2. solution : // Authored by : BaaaaaaaaaaarkingDog// Co-authored by : -// http://boj.kr/82284615e5814db489ee482ef77bcaf4#include using namespace std;int board1[21][21];int board2[21][21];int n;void rotate(){ // board2를 시계 방향으로 90도 회전하는 함수 int tmp[21][21]; for(int i = 0; i > n; for(int i = 0; i > board1[i][j]; int mx = 0; for(int tmp = 0; tm..
2024.08.20 -
[BOJ] 18808번 : 스티커 붙이기
1. problem : https://www.acmicpc.net/problem/18808 2. solution 1 :// source code 출처 : https://github.com/encrypted-def/basic-algo-lecture/blob/master/0x0D/solutions/18808.cpp#include using namespace std;int n, m, k; // 노트북 행, 열 스티커 개수 int r, c; // 스티커 row, col ; int paper[12][12];int note[42][42]; bool pastable(int x, int y) { for (int i = 0; i > n >> m >> k; while (k--) { cin >> r >> c; for ..
2024.08.20 -
[BOJ] 15683번 : 감시
1. problem : https://www.acmicpc.net/problem/15683 2. solution 1 :#include using namespace std;int office[8][8];int minZero = 1000;int N, M; // row , col; vector> v_cctv; // cctv 위치와 종류저장void xplus_count(int x, int y) { while (y 0 && idx_val 0) { y--; int idx_val = office[x][y]; //x축 음의방향으로 옮겼을 때 들어있는 값; if (idx_val == 0) office[x][y] = -1; else if (idx_val == 6) return; else if (idx_val ..
2024.08.19