QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21229. 3차원 우주 탐사

Statistics

Farmer John의 소들이 드디어 지구를 떠나 Moocraft로 우주를 떠다닙니다. 목성의 위성 Io에 있는 불타는 친척을 만나려 하지만 먼저 위험한 소행성대를 지나야 합니다.

Bessie가 조종하며 위험한 $N \times N \times N$ 구역을 통과해야 합니다. $1 \le N \le 100$입니다. 소행성은 $1 \times 1 \times 1$ 암석 블록들이 면으로 연결된 것입니다(꼭짓점만 또는 모서리만 공유하는 두 블록은 서로 다른 소행성).

구역의 서로 다른 소행성 수를 세어 도와주세요.

$3 \times 3 \times 3$ 공간의 첫 단면을 아래에 보입니다. $M$은 Moocraft의 시작 $(1,1,1)$, D는 목적지 $(3,3,3)$입니다. 이 표시는 풀이에 유용한 정보를 주기보다 주로 지도의 방향을 알려 줍니다.

그림과 입력에서 *는 소행성 조각, .는 넓고 빈 우주 공간입니다.

   가까운 단면    중간 단면        먼 단면       겹쳐 조립한 모습
     +---+            +---+          +---+                  +---+ 멀리
     |M..|            |..*|          |...|                  |...|
     |.*.|            |.*.|          |.*.|                +---+.|
     |...|            |*..|          |..D|                |..*|D|
     +---+            +---+          +---+              +---+.|-+
                                                        |M..|.|
                                                        |.*.|-+
                                                        |...|
                                                 가까이 +---+

세 소행성이 보이며 하나는 중앙을 관통하는 긴 것입니다. 조각에 표시를 붙인 지도입니다.

                                  +---+ 멀리
                                 /|...|
                                / |.1.|
                               /  |...|
                              /   +---+
                             +---+   /
                            /|..3|  /  
                           / |.1.| /
                          /  |2..|/
                         /   +---+
                        +---+   /
                        |...|  /
                        |.1.| /
                        |...|/
                 가까이 +---+

입력

  • 1번 줄: 정수 $N$.
  • $2..N^2+1$번 줄: $i-1$번 줄에는 단면 $\operatorname{int}((i+N-1)/N)$의 $1 + ((k+1)\%N)$번 줄, 즉 $N$개 문자가 있습니다.

출력

  • 1번 줄: 구역 소행성 수를 나타내는 정수 하나.

예제

입력 1

3
...
.*.
...
..*
.*.
*..
...
.*.
...

출력 1

3

문제 작성자: Andre Kessler, 2010

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.