출처 : https://www.hackerrank.com/challenges/connected-cell-in-a-grid/problem #include using namespace std; bool visited[10][10];int cnt, dy[] = {0,0,1,-1, 1, 1 , -1, -1}, dx[] = {1,-1,0,0,-1,1,1,-1};inline bool check(int i, int j, int n, int m) { return (i >= 0 && j >= 0 && i < n && j < m) ? true : false; } int dfs(int n, int m, int i, int j, int cnt, vector v) { visited[i][j] = 1; cnt++; for (in..
출처 : https://www.hackerrank.com/challenges/lilys-homework/problem #include using namespace std; vector split_string(string); int cnt(vectorarr, vectora, map m) { int ans = 0; for (int i = 0; i> n; cin.ignore(numeric_limits::max(), '\n'); string arr_temp_temp; getline(cin, arr_temp_temp); vector arr_temp = split_string(arr_temp_temp); vector arr(n); for (int i = 0; i < n; i++) { int arr_item = st..
출처 : https://www.hackerrank.com/challenges/the-grid-search/problem #include using namespace std; vector split_string(string); string gridSearch(vector G, vector P, int R, int r, int C, int c) {for (int i = 0; i t;cin.ignore(numeric_limits::max(), '\n'); for (int t_itr = 0; t_itr < t; t_itr++) {string RC_temp;getline(cin, RC_temp); vector RC = split_string(RC_temp); int R = stoi(RC[0]); int C = s..
출처 : https://www.hackerrank.com/challenges/the-time-in-words/problem #include using namespace std; string minutes[30] = { "one minute","two minutes","three minutes","four minutes","five minutes","six minutes","seven minutes","eight minutes","nine minutes","ten minutes","eleven minutes","twelve minutes","thirteen minutes","forteen minutes","quarter","sixteen minutes","seventeen minutes","eighteen..
출처 : https://www.hackerrank.com/challenges/bigger-is-greater/problem #include using namespace std; string biggerIsGreater(string w) {string z; int n = w.size();for (int i = n - 1; i >= 0; i--) {if (i == 0) return "no answer";if (w[i] == w[i - 1]) continue;if (w[i] > w[i - 1]) {char c; c = w[i]; w[i] = w[i - 1]; w[i - 1] = c;return w;}else {int j = i-1;while (j>=0) {if (w[j] >= w[j + 1]) {if (j =..
출처 : https://www.hackerrank.com/challenges/organizing-containers-of-balls/problem #include using namespace std; string organizingContainers(vector container) {int n = container.size(); vector a(n,0), b(n,0);for (int i = 0; i < n; i++) {for (int j = 0; j < n; j++) {b[i] += container[i][j]; a[j] += container[i][j];}}sort(a.begin(), a.end()); sort(b.begin(), b.end());for (int i = 0; i < n; i++) if ..
출처 : https://www.hackerrank.com/challenges/queens-attack-2/problem?h_r=internal-search #include using namespace std; vector split_string(string); int queensAttack(int n, int k, int r_q, int c_q, vector obstacles) {int ans = 0;bool check[8] = {0,0,0,0,0,0,0,0};int ck[8] = { 0,0,0,0,0,0,0,0 }; for (int i = 0; i < k; i++) {int xr = obstacles[i][0]; int xc = obstacles[i][1];if (xr == r_q && xc != c_..
출처 : https://www.hackerrank.com/challenges/encryption/problem #include using namespace std; string encryption(string s) {string ans;int L = s.length(), row = sqrt(L), col = row + 1, it = 0; if (row*row == L) col -= 1;if (row*col < L) row += 1;char arr[10][10]; memset(arr, 0, sizeof(arr));for (int i = 0; i < row; i++) {for (int j = 0; j < col && it
출처 : https://www.hackerrank.com/challenges/non-divisible-subset/problem #include using namespace std; vector split_string(string);int check[100]; int nonDivisibleSubset(int k, vector S) {int ans = 0; memset(check, 0, sizeof(check));for (int i = 0; i < S.size(); i++) {S[i] %= k; check[S[i]]++;}int tmp = k / 2; int i = tmp; int j = tmp + 1;if (check[0]) ans++;if (!(k % 2)) {if (check[tmp]) ans++;i..
출처 : https://www.hackerrank.com/challenges/magic-square-forming/problem #include using namespace std; int MS[8][3][3] = {{ 2,9,4,7,5,3,6,1,8 },{ 4,3,8,9,5,1,2,7,6 },{ 4,9,2,3,5,7,8,1,6 },{ 8,3,4,1,5,9,6,7,2 },{ 8,1,6,3,5,7,4,9,2 },{ 2,7,6,9,5,1,4,3,8 },{ 6,1,8,7,5,3,2,9,4 },{ 6,7,2,1,5,9,8,3,4 }}; int formingMagicSquare(vector s) {int ans = 9999, cnt=0;for (int m = 0; m < 8; m++) {cnt = 0;for (i..
- Total
- Today
- Yesterday
- DFS
- STL
- 입출력
- 2018 카카오 블라인드 채용
- 팁
- 알고리즘
- 17143
- 17142
- 삼성
- hackerrank
- 미세먼지 안녕!
- string
- 백준
- boj
- 17140
- 17779
- 시간 복잡도
- 게리맨더링 2
- 17837
- 새로운 게임 2
- 연구소 3
- 트렌드
- 역량 테스트
- SWEA
- 17144
- 이차원 배열과 연산
- 2018 KAKAO BLIND RECRUITMENT
- DP
- scanf
- SW Expert Academy
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |