SWexpertAcademy
-
[모의 SW 역량테스트] 탈주범 검거SWexpertAcademy 2019. 9. 29. 21:49
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 #include #include #include #include using namespace std; int tc,n,m,R,C,L; int map[51][51]; int d[51][51]; bool dist[51][51]; int dx[8][4] = {{0,0,0,0}, {0,0,1,-1},..
-
1949. [모의 SW 역량테스트] 등산로 조성SWexpertAcademy 2019. 9. 5. 21:08
정말 많이틀렸다.. 틀린이유는 딱한가지였는데... BFS할땐 기똥차게잘하면서 왜 맨날 DFS나 백트래킹할때는 시작포인트를 체킹안하는질모르겠다.. #include #include #include using namespace std; int tc,n,m; int map[10][10]; bool d[10][10]; int ans = 0; int dx[] = { 0,0,1,-1 }; int dy[] = { 1,-1,0,0 }; bool check(int x, int y, int cnt) { for (int i = 0; i = 0 && nx = 0 && ny < n) { if (d[nx]..
-
6731. 홍익이의 오델로 게임SWexpertAcademy 2019. 8. 13. 22:14
#include #include #include using namespace std; int tc; int n; char map[1000][1000]; int ans; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>tc; for(int t = 1; t>n; for(int i = 0; i >map[i][j]; if(map[i][j] == 'B'){ r[i]++; c[j]++; } } } for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ int x = r[i] + c[j]; if(ma..
-
1226. [S/W 문제해결 기본] 7일차 - 미로1SWexpertAcademy 2019. 8. 13. 01:51
#include #include #include #include #include #include using namespace std; struct se{ int x,y; se(int x, int y){ this->x = x; this->y = y; } }; int map[17][17]; bool d[17][17]; se start = se(0,0); se endi = se(0,0); int dx[] = {0,0,1,-1}; int dy[] = {1,-1,0,0}; void bfs(int x, int y){ queue q; q.push({x,y}); d[x][y] = true; while(!q.empty()){ x = q.front().first; y = q.front().second; q.pop(); f..
-
6109. 추억의 2048게임SWexpertAcademy 2019. 8. 10. 00:13
#include #include #include #include #include #include #include using namespace std; int n; int map[21][21]; int temp[21][21]; bool f[21]; int ans = 0; int sum; void move(int dir) { if (dir == 1) {//down for (int i = 0; i = 0; k--) { if (map[k][i] != 0) { if (map[k][i]..
-
2105. [모의 SW 역량테스트] 디저트 카페SWexpertAcademy 2019. 8. 5. 01:04
#include #include #include using namespace std; int tc; int n, result; int map[21][21]; bool r[21][21]; bool d[101]; int sx, sy;//출발위치 int dx[] = { 1,1,-1,-1 };// 방항 중요함 -> 어떤식으로 선택해야할지 int dy[] = { 1,-1,-1,1 }; void dfs(int x, int y, int dir, int cnt) { if (x == sx && y == sy && cnt > 1) {//종결 result = result > cnt ? result : cnt; return; } for (int i = 0; i 배열 초과하게 냅두기..
-
2117. [모의 SW 역량테스트] 홈 방범 서비스SWexpertAcademy 2019. 7. 28. 05:21
#include #include #include #include #include #include using namespace std; int tc; int n, m; int map[20][20]; int v[22][22]; int dd[22]; int cost[22]; int ans = 0; int dx[] = { 0,0,1,-1 }; int dy[] = { 1,-1,0,0 }; void initial(); void making_secu(int x, int y) { queue q; q.push(make_pair(x, y)); int cnt = map[x][y]; v[x][y] = 1; while (!q.empty()) { x = q.front().first; y = q.front().second; q.p..