曲线是正方形网格上的一组点,这样,每个点在四个邻居的邻域中恰好有两个邻居,并且这些点形成单个连接的组件。即,由网格图上的点所引起的图对于单个周期是同构的。“感应”是指两个点在循环中不彼此相邻就无法触摸输入。
图中顶点V的对映体是距离V最远的顶点。对映体在偶数长度的循环中总是唯一的(并且网格图上的每个循环都是偶数长度的)。距离的测量应由循环本身引起,而不考虑下面的方格。
您的输入应为曲线图像。曲线将#
在背景字符()之外的背景上用一系列数字符号()标记出来。曲线上的点之一将标记有
P
字符(“ pode”)。您的输出应与输入相同,除了一个曲线点应替换为A
(“ antipode”)。
您可能会假设字符将被填充为矩形。您可以假设输入的第一行和最后一行和列将完全由空格组成(输入由背景填充)。或者,您可以假设第一行和最后一行和每一列都将包含一个曲线点(输入具有最小的填充)。
您可以作为单个换行符分隔的字符串,行的数组或单个字符的2D数组输入和输出此网格。输入和输出的选择应相同。如果您的语言允许,则可以通过在适当位置修改输入而不是返回修改后的字符串或数组来输出。
可能的输入:
P# P## #P# ##### #####P# ####### #####P######### #####P#########
## # # # # # # # # # # # # # #
### ### ## ## # ### # # ### # # ### ### ### # # #
### # # ### # # # # # # # # # # # # # # # # # #
# P# ### ### # ### # # # ### ### # # # # ### ### # # # #
## # # ### # # # # # # # # # # # # #
# # P # ##### P # ########### # # ##### ##### # # #
### ####### ### # # # # # # # #
############### ####### ####### ###############
相应的输出:
P# P## #P# #A### #####P# #A##### #####P######### #####P#########
#A # # # # # # # # # # # # # #
##A #A# ## ## # ### # # ### # # ### ### ### # # #
### # # ### # # # # # # # # # # # # A # # # # #
# P# ### ##A # ### # # # ### ### # # # # ### ### # # # #
## # # ### # # # # # # # # # # # # #
A # P # ##### P # ########### # # ##### ##### # # #
### ####### ### # # # # # # # #
############### ####### ####### #########A#####
距吊舱的顶点距离(模10)(不输出这些):
P1 P12 1P1 5A543 54321P1 9A98765 54321P123456789 54321P123456789
1A 1 3 2 2 4 2 6 2 8 4 6 0 6 0
23A 3A3 32 01 7 109 3 7 109 3 7 901 789 543 1 7 1
321 1 9 543 8 2 8 4 6 2 8 2 8 8 2 6 A 6 2 2 8 2
4 P1 234 89A 0 876 2 9 3 765 543 7 1 9 7 345 987 1 3 9 3
56 2 1 567 9 9 1 0 4 6 0 0 6 0 4 0 4
A 3 P 8 87654 P 1 56789012345 9 1 54321 56789 5 1 5
654 1234567 321 2 8 2 0 4 6 2 6
345678901234567 3456789 3210987 345678901A10987