質問編集履歴
2
直したため
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
}
|
|
31
31
|
else if(B[y][x] == '#'){
|
|
32
32
|
repr(dy,-1,2){ //B[y][x]の周りの8方向調べる
|
|
33
|
-
repr(dx,-1,2){
|
|
33
|
+
repr(dx,-1,2){
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
int xx = x + dx;
|
|
36
36
|
int yy = y + dy;
|
|
37
37
|
if(dx == -1 && dy == -1)
|
|
@@ -42,34 +42,34 @@
|
|
|
42
42
|
continue;
|
|
43
43
|
else if(dx == 1 && dy == 1)
|
|
44
44
|
continue;
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
if(xx >= 0 && xx <W && yy >= 0 && yy <H ){ //範囲内でもし#があればnをインクリメント
|
|
47
47
|
if(B[yy][xx] == '#'){
|
|
48
48
|
n++;
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
}
|
|
57
57
|
if(n >= 1)
|
|
58
58
|
ans = true;
|
|
59
59
|
if(ans == false) //各ループでansがfalseのままならループを抜け出す
|
|
60
60
|
break;
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
}
|
|
63
63
|
if(ans == false ) //同様
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
|
|
67
|
+
|
|
68
68
|
if(ans)
|
|
69
69
|
cout << "Yes" << endl;
|
|
70
70
|
else
|
|
71
71
|
cout << "No" << endl;
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
|
|
73
|
+
|
|
74
74
|
}
|
|
75
75
|
```
|
1
全角をなくした
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
rep(y,H){
|
|
26
26
|
rep(x,W){
|
|
27
27
|
ans = false;
|
|
28
|
-
if(B[y][x] == '.'){
|
|
28
|
+
if(B[y][x] == '.'){ //B[y][x]が.であれば次へ
|
|
29
29
|
continue;
|
|
30
30
|
}
|
|
31
31
|
else if(B[y][x] == '#'){
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
int yy = y + dy;
|
|
37
37
|
if(dx == -1 && dy == -1)
|
|
38
38
|
continue;
|
|
39
|
-
else if(dx == -1 && dy == 1)
|
|
39
|
+
else if(dx == -1 && dy == 1) //8方向のうち斜めを除外
|
|
40
40
|
continue;
|
|
41
41
|
else if(dx == 1 && dy == -1)
|
|
42
42
|
continue;
|
|
43
43
|
else if(dx == 1 && dy == 1)
|
|
44
44
|
continue;
|
|
45
45
|
|
|
46
|
-
if(xx >= 0 && xx <W && yy >= 0 && yy <H ){
|
|
46
|
+
if(xx >= 0 && xx <W && yy >= 0 && yy <H ){ //範囲内でもし#があればnをインクリメント
|
|
47
47
|
if(B[yy][xx] == '#'){
|
|
48
48
|
n++;
|
|
49
49
|
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
}
|
|
57
57
|
if(n >= 1)
|
|
58
58
|
ans = true;
|
|
59
|
-
if(ans == false)
|
|
59
|
+
if(ans == false) //各ループでansがfalseのままならループを抜け出す
|
|
60
60
|
break;
|
|
61
61
|
|
|
62
62
|
}
|
|
63
|
-
if(ans == false )
|
|
63
|
+
if(ans == false ) //同様
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
66
|
|