Hyuk(199)
-
[백준 2089번] -2진수
소스코드1234567891011121314151617181920212223242526#include using namespace std; void cal(long long a) { if (a == 0) return; if (a
2017.07.28 -
[백준 9934번] 완전 이진 트리
소스코드12345678910111213141516171819202122232425262728293031323334#include using namespace std; int k, num[1024], End = 2, tree[11][512], depth_idx[10] = {0,}; void building(int start,int end, int depth) { if (end - start > k; for (int i = 1; i num[i]; building(1,End-1,0); for (int i = 0; i
2017.07.27 -
[백준 1182번] 부분집합의 합
소스코드123456789101112131415161718192021222324#include using namespace std; int n, num[21], des, cnt=0; void cal(int idx, int sum) { sum += num[idx]; if (idx >= n) return; if (sum == des) cnt++; cal(idx + 1, sum-num[idx]); cal(idx + 1, sum);} int main() { cin >> n >> des; for (int i = 0; i > num[i]; } cal(0, 0); cout
2017.07.27 -
[백준 1799번] 비숍
소스코드123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172#include using namespace std; int n, board[11][11], Max = 0, visit[21] = { 0, }, visit_1[21] = { 0, }; void white(int a, int b, int cnt) { if (cnt > Max) Max = cnt; if (b >= n) { a++; if (a % 2 == 0) b = 0; else b = 1; } if (a >= n) return; if (visit[a + b] =..
2017.07.26 -
[백준 2493번] 탑
소스코드12345678910111213141516171819202122232425262728293031323334353637#include using namespace std; int main() { int n,building[500001],result[500001]; int Max=0, Max_idx=0, Mid=0, Mid_idx=0; cin >> n; for (int i = 1; i > building[i]; } for (int i = 1; i Max) { result[i] = 0; Max = building[i]; Max_idx = i; } else if (building[i]
2017.07.26 -
[코드그라운드] 극단적인 수
소스코드12345678910111213141516171819202122232425262728#include using namespace std; void cal(int a) { if (a == 1) { return; } cal(a / 2); if (a % 2 == 0) cout
2017.07.26