跳到正文

题解

关于p6160向量

chenziyv123约 5 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 5 分钟
获赞
1
题目
P6160

版本

  1. v1当前

P6160题解

题目传送门

平面向量知识储备

  1. a→⋅b→=∣a→∣⋅∣b→∣⋅cos⁡<a→,b→>\overrightarrow{a}\cdot\overrightarrow{b}= |\overrightarrow{a}|\cdot|\overrightarrow{b}| \cdot\cos<\overrightarrow{a},\overrightarrow{b}>
  2. 三角形法则
  3. 平行四边形法则
  4. ∣a→∣+∣b→∣≥∣a→±b→∣≥∣∣a→∣−∣b→∣∣|\overrightarrow{a}|+|\overrightarrow{b}|\ge |\overrightarrow{a}\pm \overrightarrow{b}|\ge ||\overrightarrow{a}|-|\overrightarrow{b}||

思路梳理

1.转形式:根据完全平方和公式,将σ转换形式,便于最小值求解

2.分类讨论:(1) r1+r2>r3r_1+r_2>r_3 (2) r1+r2≤r3r_1+r_2\le r_3


具体分析及代码

σ=min(a→⋅b→+b→⋅c→+a→⋅c→)σ= min(\overrightarrow{a}\cdot\overrightarrow{b}+\overrightarrow{b}\cdot\overrightarrow{c}+\overrightarrow{a}\cdot\overrightarrow{c}) =min[(a→+b→+c→)2−a→2−b→2−c→22]=min[\dfrac{(\overrightarrow{a}+\overrightarrow{b}+\overrightarrow{c})^2-\overrightarrow{a}^2-\overrightarrow{b}^2-\overrightarrow{c}^2}{2}] =min[(a→+b→+c→)2−r12−r22−r322]=min[\dfrac{(\overrightarrow{a}+\overrightarrow{b}+\overrightarrow{c})^2-r_1^2-r_2^2-r_3^2}{2}]

其中,−r12−r22−r32-r_1^2-r_2^2-r_3^2为定值,所以当(a→+b→+c→)2(\overrightarrow{a}+\overrightarrow{b}+\overrightarrow{c})^2取最小时σ有最小值

分类讨论:

1.r1+r2>r3r_1+r_2>r_3时,即a→,b→,c→\overrightarrow{a},\overrightarrow{b},\overrightarrow{c}可以构成三角形,有a→+b→=c→\overrightarrow{a}+\overrightarrow{b}=\overrightarrow{c},有∣a→+b→+c→∣≥∣a→+b→∣−∣c→∣=0|\overrightarrow{a}+\overrightarrow{b}+\overrightarrow{c}|\ge |\overrightarrow{a}+\overrightarrow{b}|-|\overrightarrow{c}|=0.所以σ=−r12+r22+r322-\dfrac{r_1^2+r_2^2+r_3^2}{2}

代码:

C++
if(r1+r2>r3)
{
    cout<<fixed<<setprecision(1)<<-((pow(r1,2)+pow(r2,2)+pow(r3,2)))/2;
}

2.r1+r2≤r3r_1+r_2\le r_3时,即a→,b→,c→\overrightarrow{a},\overrightarrow{b},\overrightarrow{c}不可以构成三角形,有∣a→+b→+c→∣≥∣c→∣−∣a→+b→∣,a→+b→=xc→,0<x<1|\overrightarrow{a}+\overrightarrow{b}+\overrightarrow{c}|\ge |\overrightarrow{c}|-|\overrightarrow{a}+\overrightarrow{b}|,\overrightarrow{a}+\overrightarrow{b}=x\overrightarrow{c},0<x<1,所以∣a→+b→+c→∣=(1−x)∣c→∣|\overrightarrow{a}+\overrightarrow{b}+\overrightarrow{c}|=(1-x)|\overrightarrow{c}|又有∣a→+b→∣=∣xc→∣≤∣a→∣+∣b→∣|\overrightarrow{a}+\overrightarrow{b}|=|x\overrightarrow{c}|\le |\overrightarrow{a}|+|\overrightarrow{b}| (由于有平方所以只计算模即可),当∣xc→∣|x\overrightarrow{c}|取最大时∣a→+b→+c→∣|\overrightarrow{a}+\overrightarrow{b}+\overrightarrow{c}|取最小值−(r1+r2)+r3=r3−r1−r2-(r_1+r_2)+r_3=r_3-r_1-r_2

σ= (r3−r1−r2)2−r12−r22−r322=2(r1r2−r2r3−r1r3)2=r1r2−r2r3−r1r3\dfrac{(r_3-r_1-r_2)^2-r_1^2-r_2^2-r_3^2}{2}=\dfrac{2(r_1r_2-r_2r_3-r_1r_3)}{2}=r_1r_2-r_2r_3-r_1r_3(共线)

代码:

C++
else
{
   cout<<fixed<<setprecision(1)<<r1*r2-r2*r3-r1*r3;
}

AC代码

C++
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long double r1,r2,r3;
	cin>>r1>>r2>>r3;
	if(r1+r2-r3>=0 )
	{
		cout<<fixed<<setprecision(1)<<-((pow(r1,2)+pow(r2,2)+pow(r3,2)))/2;//r1,r2,r3
	}
	else
	{
		cout<<fixed<<setprecision(1)<<r1*r2-r2*r3-r1*r3;
	}
	return 0;
 }

注意!

本题定义需使用 long double

原文