전체 글
-
뿌요뿌요백준알고리즘 2019. 8. 14. 17:53
#include #include #include #include using namespace std; int map[12][6]; bool d[12][6]; bool go[12]; int dx[] = {0,0,1,-1}; int dy[] = {1,-1,0,0}; int ans = 0; bool keep = false; void modi_map(){ for(int i = 0; i = 0; j--){ if(go[j] == false){ for(int k = j-1; k >= 0; ..
-
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..
-
배열 돌리기 4백준알고리즘 2019. 8. 13. 22:10
#include #include #include #include #include using namespace std; struct rot { int r, c, s; }; int n, m, k; int map[51][51]; int temp[51][51]; rot rotat[6]; int ans = 10000; //x1 작은거 x2큰거 y1작은거 y2큰거 void rotation(int x1, int y1, int x2, int y2) { if (x1 == x2 && y1 == y2) { return; } int temp = map[x1][y1]; //y1고정 for (int i = x1; i < x2; i++) { map[i][y1] = map[i+1][y1]; } int temp2 = map[x1][y..
-
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..
-
연구소 3백준알고리즘 2019. 8. 11. 23:13
#include #include #include #include #include #include #include using namespace std; vector virus; int n, m; int map[50][50]; int posi[50][50]; bool temp[50][50]; bool temp2[50][50]; int ans = 10000000; int dx[] = {0,0,1,-1}; int dy[] = {1,-1,0,0}; int main(){ scanf("%d %d", &n, &m); for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ scanf("%d", &map[i][j]); if(map[i][j] == 2){ virus.push_ba..
-
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]..