跳到正文

题解

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

CZPchenzipei约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年3月14日
篇幅
约 1 分钟
获赞
1
题目
P12130

版本

  1. v1当前

做题策略:先水平移动到足够大的半径 rr,使得目标点 (233,666)(233,666) 位于圆周上;

然后沿圆周移动所需角度 θ=atan⁡2(666,233)\theta=\operatorname{atan}2(666,233);

总距离=水平移动距离 (r)+(r)+ 圆周移动距离 (rθ)(r\theta);

最优解出现在 r=2332+6662r=\sqrt{233²+666²} 时。

计算:半径 r=2332+6662≈706.155r=\sqrt{233²+666^2}\approx706.155;

角度 θ=atan⁡(666/233)≈1.2310\theta=\operatorname{atan}(666/233)\approx1.2310 弧度;

总距离 =r+rθ≈706.155+706.155×1.2310≈1576.448=r+r\theta\approx706.155+706.155\times1.2310\approx1576.448; 四舍五入得 15761576。

C++
#include<bits/stdc++.h>
using namespace std;
int main(){
	printf("1576");
	return 0;
}
原文