Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 72f256a

Browse files
committedMay 3, 2022
마법사 상어와 파이어스톰
1 parent fe8b30f commit 72f256a

3 files changed

+89
-1
lines changed
 

‎SAMSUNG Intern Prepare/SAMSUNG Intern Prepare.vcxproj

+4-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@
139139
</Link>
140140
</ItemDefinitionGroup>
141141
<ItemGroup>
142-
<ClCompile Include="마법사 상어와 비바라기.cpp" />
142+
<ClCompile Include="마법사 상어와 비바라기.cpp">
143+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
144+
</ClCompile>
145+
<ClCompile Include="마법사 상어와 파이어스톰.cpp" />
143146
<ClCompile Include="뱀.cpp">
144147
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
145148
</ClCompile>

‎SAMSUNG Intern Prepare/SAMSUNG Intern Prepare.vcxproj.filters

+3
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,8 @@
3636
<ClCompile Include="마법사 상어와 비바라기.cpp">
3737
<Filter>소스 파일</Filter>
3838
</ClCompile>
39+
<ClCompile Include="마법사 상어와 파이어스톰.cpp">
40+
<Filter>소스 파일</Filter>
41+
</ClCompile>
3942
</ItemGroup>
4043
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int dx[4] = { 1, 0, -1, 0 };
5+
int dy[4] = { 0 ,1, 0, -1 };
6+
7+
int N, L, Q;
8+
int map[64][64];
9+
int change_map[64][64];
10+
int visit[64][64] = {0, };
11+
int mass = 0;
12+
13+
void dfs(int x, int y) {
14+
visit[x][y] = 1;
15+
for (int k = 0; k < 4; k++) {
16+
int nx = map[x][y] + dx[k];
17+
int ny = map[x][y] + dy[k];
18+
19+
if (nx < 0 || nx > pow(2, N) - 1 || ny <0 || ny > pow(2, N)) {
20+
continue;
21+
}
22+
23+
if (!visit[nx][ny] && map[nx][ny]) {
24+
dfs(nx, ny);
25+
}
26+
mass++;
27+
}
28+
29+
}
30+
31+
void firestorm(int L) {
32+
33+
for (int i = 0; i < pow(2, N); i++) {
34+
for (int j = 0; j < pow(2, N); j++) {
35+
36+
}
37+
}
38+
39+
for (int i = 0; i < pow(2, N); i++) {
40+
for (int j = 0; j < pow(2, N); j++) {
41+
42+
int near_ice = 0;
43+
for (int k = 0; k < 4; k++) {
44+
int nx = map[i][j] + dx[k];
45+
int ny = map[i][j] + dy[k];
46+
47+
if (nx < 0 || nx > pow(2, N) - 1 || ny <0 || ny > pow(2, N)) {
48+
continue;
49+
}
50+
51+
if (map[nx][ny]) {
52+
near_ice++;
53+
}
54+
55+
if (near_ice < 3) {
56+
if (map[i][j] > 0) {
57+
map[i][j] --;
58+
}
59+
}
60+
61+
62+
}
63+
}
64+
}
65+
}
66+
67+
int main(void) {
68+
cin >> N >> Q;
69+
70+
for (int i = 0; i < pow(2, N); i++) {
71+
for (int j = 0; j < pow(2, N); j++) {
72+
cin >> map[i][j];
73+
}
74+
}
75+
76+
77+
for (int i = 0; i < pow(2, N); i++) {
78+
for (int j = 0; j < pow(2, N); j++) {
79+
dfs(i, j);
80+
}
81+
}
82+
}

0 commit comments

Comments
 (0)
Please sign in to comment.