额——各位大佬看看有什么问题啊,显示的都是re,没注释,请见谅
查看原帖
额——各位大佬看看有什么问题啊,显示的都是re,没注释,请见谅
555002
yrs2021楼主2021/8/21 19:56

a = [[0 for i in range(10)] for i in range(10)] for c in range(10): b = input() d = 0 for i in b: if i == "F": x1 = d y1 = c direction1 = 90 if i == "C": x2 = d y2 = c direction2 = 90 a[c][d] = i d += 1 m = 0 t = 0 p = 0 while t == 0: if direction1 == 90: if y1 - 1 >= 0: if a[y1 - 1][x1] == ".": a[y1 - 1][x1] = "F" a[y1][x1] = "." y1 -= 1 if a[y1 - 1][x1] == "C": p = 1 if direction2 == 90: if y2 - 1 >= 0: if a[y2 - 1][x2] == ".": a[y2 - 1][x2] = "C" a[y2][x2] = "." y2 -= 1 else: t = 1 else: t = 1 if direction2 == 270: if y2 + 1 <= 9: if a[y2 + 1][x2] == ".": a[y2 + 1][x2] = "C" a[y2][x2] = "." y2 += 1 else: t = 1 else: t = 1 if direction2 == 0: if x2 + 1 <= 9: if a[y2][x2 + 1] == ".": a[y2][x2 + 1] = "C" a[y2][x2] = "." x2 += 1 else: t = 1 else: t = 1 if direction2 == 180: if x2 - 1 >= 0: if a[y2][x2 - 1] == ".": a[y2][x2 - 1] = "C" a[y2][x2] = "." x2 -= 1 else: t = 1 else: t = 1 if t != 1: a[y1 - 1][x1] = "F" a[y1][x1] = "." y1 -= 1 if a[y1 - 1][x1] == "": direction1 = 0 else: direction1 = 0 if direction1 == 270: if y1 + 1 <= 9: if a[y1 + 1][x1] == ".": a[y1 + 1][x1] = "F" a[y1][x1] = "." y1 += 1 if a[y1 + 1][x1] == "C": p = 1 if direction2 == 90: if y2 - 1 >= 0: if a[y2 - 1][x2] == ".": a[y2 - 1][x2] = "C" a[y2][x2] = "." y2 -= 1 else: t = 1 else: t = 1 if direction2 == 270: if y2 + 1 <= 9: if a[y2 + 1][x2] == ".": a[y2 + 1][x2] = "C" a[y2][x2] = "." y2 += 1 else: t = 1 else: t = 1 if direction2 == 0: if x2 + 1 <= 9: if a[y2][x2 + 1] == ".": a[y2][x2 + 1] = "C" a[y2][x2] = "." x2 += 1 else: t = 1 else: t = 1 if direction2 == 180: if x2 - 1 >= 0: if a[y2][x2 - 1] == ".": a[y2][x2 - 1] = "C" a[y2][x2] = "." x2 -= 1 else: t = 1 else: t = 1 if t != 1: a[y1 + 1][x1] = "F" a[y1][x1] = "." y1 += 1 if a[y1 + 1][x1] == "": direction1 = 180 else: direction1 = 180 if direction1 == 0: if x1 + 1 <= 9: if a[y1][x1 + 1] == ".": a[y1][x1 + 1] = "F" a[y1][x1] = "." x1 += 1 if a[y1][x1 + 1] == "C": p = 1 if direction2 == 90: if y2 - 1 >= 0: if a[y2 - 1][x2] == ".": a[y2 - 1][x2] = "C" a[y2][x2] = "." y2 -= 1 else: t = 1 else: t = 1 if direction2 == 270: if y2 + 1 <= 9: if a[y2 + 1][x2] == ".": a[y2 + 1][x2] = "C" a[y2][x2] = "." y2 += 1 else: t = 1 else: t = 1 if direction2 == 0: if x2 + 1 <= 9: if a[y2][x2 + 1] == ".": a[y2][x2 + 1] = "C" a[y2][x2] = "." x2 += 1 else: t = 1 else: t = 1 if direction2 == 180: if x2 - 1 >= 0: if a[y2][x2 - 1] == ".": a[y2][x2 - 1] = "C" a[y2][x2] = "." x2 -= 1 else: t = 1 else: t = 1 if t != 1: a[y1][x1 + 1] = "F" a[y1][x1] = "." x1 += 1 if a[y1][x1 + 1] == "": direction1 = 270 else: direction1 = 270 if direction1 == 180: if x1 - 1 >= 0: if a[y1][x1 - 1] == ".": a[y1][x1 - 1] = "F" a[y1][x1] = "." x1 -= 1 if a[y1][x1 - 1] == "C": p = 1 if direction2 == 90: if y2 - 1 >= 0: if a[y2 - 1][x2] == ".": a[y2 - 1][x2] = "C" a[y2][x2] = "." y2 -= 1 else: t = 1 else: t = 1 if direction2 == 270: if y2 + 1 <= 9: if a[y2 + 1][x2] == ".": a[y2 + 1][x2] = "C" a[y2][x2] = "." y2 += 1 else: t = 1 else: t = 1 if direction2 == 0: if x2 + 1 <= 9: if a[y2][x2 + 1] == ".": a[y2][x2 + 1] = "C" a[y2][x2] = "." x2 += 1 else: t = 1 else: t = 1 if direction2 == 180: if x2 - 1 >= 0: if a[y2][x2 - 1] == ".": a[y2][x2 - 1] = "C" a[y2][x2] = "." x2 -= 1 else: t = 1 else: t = 1 if t != 1: a[y1][x1 - 1] = "F" a[y1][x1] = "." x1 -= 1 if a[y1][x1 - 1] == "": direction1 = 90 else: direction1 = 90 if p != 1: p = 0 if direction2 == 90: if y2 - 1 >= 0: if a[y2 - 1][x2] == ".": a[y2 - 1][x2] = "C" a[y2][x2] = "." y2 -= 1 if a[y2 - 1][x2] == "": direction2 = 0 if a[y2 - 1][x2] == "F": t = 1 else: direction2 = 0 if direction2 == 270: if y2 + 1 <= 9: if a[y2 + 1][x2] == ".": a[y2 + 1][x2] = "C" a[y2][x2] = "." y2 += 1 if a[y2 + 1][x2] == "": direction2 = 180 if a[y2 + 1][x2] == "F": t = 1 else: direction2 = 180 if direction2 == 0: if x2 + 1 <= 9: if a[y2][x2 + 1] == ".": a[y2][x2 + 1] = "C" a[y2][x2] = "." x2 += 1 if a[y2][x2 + 1] == "": direction2 = 270 if a[y2][x2 + 1] == "F": t = 1 else: direction2 = 270 if direction2 == 180: if x2 - 1 >= 0: if a[y2][x2 - 1] == ".": a[y2][x2 - 1] = "C" a[y2][x2] = "." x2 -= 1 if a[y2][x2 - 1] == "": direction2 = 90 if a[y2][x2 - 1] == "F": t = 1 else: direction2 = 90 m += 1 m += 1 print(m)

2021/8/21 19:56
加载中...