๋ชฉ๋ก์ ์ฒด ๊ธ (1096)
KoreanFoodie's Study
SW ์ญ๋ ํ ์คํธ ์ค๋น๋ฅผ ์ํ ํต์ฌ ๋ฌธ์ ๋ค์ ๋ค๋ฃน๋๋ค! ํด๋ต์ ๋ณด๊ธฐ ์ ์ ๋ฌธ์ ๋ฅผ ํ์ด๋ณด์๊ฑฐ๋, ์ค๊ณ๋ฅผ ํ๊ณ ์ค์๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค. ์ฝ๋์ ๋ํ ์ค๋ช ์ ์ฃผ์์ ์ฐธ๊ณ ํด ์ฃผ์ธ์ :) ๋ฌธ์ ๋งํฌ : www.acmicpc.net/problem/13458 ํด๋ต ์ฝ๋ : #include #include using namespace std; int N, B, C; vector rooms; int main() { long long ans = 0L; int t; int n; cin >> N; for (int i =0; i > n; rooms.push_back(n); } cin >> B >> C; for (int i =0; i < N; i++) { t = rooms[i]; t -= B; a..
SW ์ญ๋ ํ ์คํธ ์ค๋น๋ฅผ ์ํ ํต์ฌ ๋ฌธ์ ๋ค์ ๋ค๋ฃน๋๋ค! ํด๋ต์ ๋ณด๊ธฐ ์ ์ ๋ฌธ์ ๋ฅผ ํ์ด๋ณด์๊ฑฐ๋, ์ค๊ณ๋ฅผ ํ๊ณ ์ค์๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค. ์ฝ๋์ ๋ํ ์ค๋ช ์ ์ฃผ์์ ์ฐธ๊ณ ํด ์ฃผ์ธ์ :) ๋ฌธ์ ๋งํฌ : www.acmicpc.net/problem/3190 ํด๋ต ์ฝ๋ : #include #include #include #include using namespace std; typedef struct turn { int sec; char dir; }turn; typedef struct pos { int row; int col; }pos; int N, K, L; int map[101][101]; deque t_list; deque snake; // Up, Down, Left, Right int dR[4] = {-1, 1..
SW ์ญ๋ ํ ์คํธ ์ค๋น๋ฅผ ์ํ ํต์ฌ ๋ฌธ์ ๋ค์ ๋ค๋ฃน๋๋ค! ํด๋ต์ ๋ณด๊ธฐ ์ ์ ๋ฌธ์ ๋ฅผ ํ์ด๋ณด์๊ฑฐ๋, ์ค๊ณ๋ฅผ ํ๊ณ ์ค์๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค. ์ฝ๋์ ๋ํ ์ค๋ช ์ ์ฃผ์์ ์ฐธ๊ณ ํด ์ฃผ์ธ์ :) ๋ฌธ์ ๋งํฌ : www.acmicpc.net/problem/12100 ํด๋ต ์ฝ๋ : #include #include using namespace std; int N; int ans; int map[20][20]; // Up, Down, Left, Right int dR[4] = {-1, 1, 0, 0}; int dC[4] = {0, 0, -1, 1}; void copy_map(int dst[20][20], int src[20][20]) { for (int i = 0; i < N; i++) { for (int j = 0; j < ..
SW ์ญ๋ ํ ์คํธ ์ค๋น๋ฅผ ์ํ ํต์ฌ ๋ฌธ์ ๋ค์ ๋ค๋ฃน๋๋ค! ํด๋ต์ ๋ณด๊ธฐ ์ ์ ๋ฌธ์ ๋ฅผ ํ์ด๋ณด์๊ฑฐ๋, ์ค๊ณ๋ฅผ ํ๊ณ ์ค์๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค. ์ฝ๋์ ๋ํ ์ค๋ช ์ ์ฃผ์์ ์ฐธ๊ณ ํด ์ฃผ์ธ์ :) ๋ฌธ์ ๋งํฌ : www.acmicpc.net/problem/13460 ํด๋ต ์ฝ๋ : #include #include #include using namespace std; int N, M; char map[10][10]; int ans; bool b_hole; // true if blue goes down to hole // Up, Down, Left, Right // right, down, left, up int dR[4] = {0, 1, 0, -1}; int dC[4] = {1, 0, -1, 0}; void copy_map(c..
SW ์ญ๋ ํ ์คํธ ์ค๋น๋ฅผ ์ํ ํต์ฌ ๋ฌธ์ ๋ค์ ๋ค๋ฃน๋๋ค! ํด๋ต์ ๋ณด๊ธฐ ์ ์ ๋ฌธ์ ๋ฅผ ํ์ด๋ณด์๊ฑฐ๋, ์ค๊ณ๋ฅผ ํ๊ณ ์ค์๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค. ์ฝ๋์ ๋ํ ์ค๋ช ์ ์ฃผ์์ ์ฐธ๊ณ ํด ์ฃผ์ธ์ :) ๋ฌธ์ ๋งํฌ : swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWXRFInKex8DFAUo ํด๋ต ์ฝ๋ : #include #include #include using namespace std; typedef struct atom { int x; int y; int dir; int energy; }atom; typedef struct crush { int in1; // index of atoms[1001] int in2; int min_time_2; //..
SW ์ญ๋ ํ ์คํธ ์ค๋น๋ฅผ ์ํ ํต์ฌ ๋ฌธ์ ๋ค์ ๋ค๋ฃน๋๋ค! ํด๋ต์ ๋ณด๊ธฐ ์ ์ ๋ฌธ์ ๋ฅผ ํ์ด๋ณด์๊ฑฐ๋, ์ค๊ณ๋ฅผ ํ๊ณ ์ค์๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค. ์ฝ๋์ ๋ํ ์ค๋ช ์ ์ฃผ์์ ์ฐธ๊ณ ํด ์ฃผ์ธ์ :) ๋ฌธ์ ๋งํฌ : swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWXRJ8EKe48DFAUo ํด๋ต ์ฝ๋ : #include #include #include using namespace std; typedef struct cell { int row; int col; int deact; int act; int X; }cell ; typedef struct info { int alloc; int X; }info; int M, N, K; int dR[4] = ..
SW ์ญ๋ ํ ์คํธ ์ค๋น๋ฅผ ์ํ ํต์ฌ ๋ฌธ์ ๋ค์ ๋ค๋ฃน๋๋ค! ํด๋ต์ ๋ณด๊ธฐ ์ ์ ๋ฌธ์ ๋ฅผ ํ์ด๋ณด์๊ฑฐ๋, ์ค๊ณ๋ฅผ ํ๊ณ ์ค์๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค. ์ฝ๋์ ๋ํ ์ค๋ช ์ ์ฃผ์์ ์ฐธ๊ณ ํด ์ฃผ์ธ์ :) ๋ฌธ์ ๋งํฌ : www.acmicpc.net/problem/14891 ํด๋ต ์ฝ๋ : #include #include #include using namespace std; int K; deque gear[4]; int dir[4]; // direction of each gear // 1 : clockwise // -1 : counter-clockwise // 0 : stay still // clockwise turn void clock(deque g) { int temp = g.back(); g.pop_back(); g.push_..
SW ์ญ๋ ํ ์คํธ ์ค๋น๋ฅผ ์ํ ํต์ฌ ๋ฌธ์ ๋ค์ ๋ค๋ฃน๋๋ค! ํด๋ต์ ๋ณด๊ธฐ ์ ์ ๋ฌธ์ ๋ฅผ ํ์ด๋ณด์๊ฑฐ๋, ์ค๊ณ๋ฅผ ํ๊ณ ์ค์๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค. ์ฝ๋์ ๋ํ ์ค๋ช ์ ์ฃผ์์ ์ฐธ๊ณ ํด ์ฃผ์ธ์ :) ๋ฌธ์ ๋งํฌ : swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV597vbqAH0DFAVl ํด๋ต ์ฝ๋ : #include #include #include using namespace std; typedef struct micro { int row; int col; int num; // ๋ฏธ์๋ฌผ์ ๊ฐฏ์ int dir; // ์ ํ ์ข ์ฐ ๊ฐ๊ฐ 0 1 2 3 bool same; } micro; int N, M, K; int org_sum; // ์, ํ, ..
SW ์ญ๋ ํ ์คํธ ์ค๋น๋ฅผ ์ํ ํต์ฌ ๋ฌธ์ ๋ค์ ๋ค๋ฃน๋๋ค! ํด๋ต์ ๋ณด๊ธฐ ์ ์ ๋ฌธ์ ๋ฅผ ํ์ด๋ณด์๊ฑฐ๋, ์ค๊ณ๋ฅผ ํ๊ณ ์ค์๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค. ์ฝ๋์ ๋ํ ์ค๋ช ์ ์ฃผ์์ ์ฐธ๊ณ ํด ์ฃผ์ธ์ :) ๋ฌธ์ ๋งํฌ : swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWIeW7FakkUDFAVH ํด๋ต ์ฝ๋ : #include #include #include using namespace std; int N, X; int map[20][20]; int num_road; bool isRange(int x) { if (x = N) { return false; } else return true; } // change x-y coordinates..
SW ์ญ๋ ํ ์คํธ ์ค๋น๋ฅผ ์ํ ํต์ฌ ๋ฌธ์ ๋ค์ ๋ค๋ฃน๋๋ค! ํด๋ต์ ๋ณด๊ธฐ ์ ์ ๋ฌธ์ ๋ฅผ ํ์ด๋ณด์๊ฑฐ๋, ์ค๊ณ๋ฅผ ํ๊ณ ์ค์๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค. ์ฝ๋์ ๋ํ ์ค๋ช ์ ์ฃผ์์ ์ฐธ๊ณ ํด ์ฃผ์ธ์ :) ๋ฌธ์ ๋งํฌ : swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5-BEE6AK0DFAVl& ํด๋ต ์ฝ๋ : // c++ #include #include #include using namespace std; vector people; vector stair; int N; int board[10][10] = { 0, }; int mappingTable[10]; int answer; int peopleCnt; int getTime() { int t = 0;..