题解:P12130 [蓝桥杯 2025 省 B] 移动距离

· · 题解

细究后可以发现,一次性到达在做圆周运动一定最优。

不妨以圆心为原点,过点 (233,666) 做圆 A。

根据距离公式 dis(P,Q)=\sqrt{(P_x-Q_x)^2 +(P_y-Q_y)^2} 得半径 r=\sqrt {233^2+666^2}。

即小明须先沿 x 轴移动 \sqrt {233^2+666^2} 单位,再沿圆 A 移动 \arctan(666/233) 米。

所以,总距离:

S=\operatorname{round}(\sqrt{233^2+666^2} \times (\arctan(666/233)+1)) \approx 1576

AC 代码如下:

#include<bits/stdc++.h>
using namespace std;
int main(){
    cout<<1576<<endl;
    return 0;
}

简单草率!