现在居然出现一道题只有\(pascal\)题解没有\(C++\)题解的情况,小蒟蒻要打破它. 思维题:分类讨论 回归正题,此题十分考验思维,首先我们要考虑如何把不会走的地方给填上,使最后只用求一遍这个图的周长即可.考虑目标点的几种情况: \(0.\)当前点周围有三个\(A\)或四个\(A\)时:这个点肯定不会走到,直接用\(A\)填上. \(1.\)当前点夹在两个点中间,无法判断这个点被填上后是否会让两边出现独立的\(x\),所以跳过该点,之后如果某一边被填满,会导致这个点被重新搜到,那时再考虑…