백준 1018번 C++
#include #include #include using namespace std; const int MAX = 51;int m, n;string arr[MAX];string whitestart[8] = { { "WBWBWBWB" },{ "BWBWBWBW" },{ "WBWBWBWB" },{ "BWBWBWBW" },{ "WBWBWBWB" },{ "BWBWBWBW" },{ "WBWBWBWB" },{ "BWBWBWBW" }};string blackstart[8] = { { "BWBWBWBW" },{ "WBWBWBWB" },{ "BWBWBWBW" },{ "WBWBWBWB" },{ "BWBWBWBW" },{ "WBWBWBWB" },{ "BWBWBWBW" },{ "WBWBWBWB" } }; int calwhite..
2019. 2. 4.
백준 14888번 C++
#include#includeusing namespace std; const int MAX = 1000000001;int n;int number[12];int operators[4];int maxans = -MAX;int minans = MAX; void dfs(int plus, int minus, int mul, int div, int count, int sum) {if (count == n) {maxans = max(maxans, sum);minans = min(minans, sum);}if (plus > 0)dfs(plus - 1, minus, mul, div, count + 1, sum + number[count]);if (minus > 0)dfs(plus, minus - 1, mul, div, ..
2019. 1. 28.
백준 14500번 C++
#include#includeusing namespace std; const int MAX = 501;int n, m;int arr[MAX][MAX];int visited[MAX][MAX]; typedef struct {int a, b;}Move;Move mv[4] = { {1,0},{-1,0},{0,1},{0,-1} }; int dfs(int x, int y,int counts) {if (counts == 4)return 0; int ans = 0;for (int i = 0; i = 0 && mx = 0 && my < m) {if (visited[mx][my] == 0) {v..
2019. 1. 27.