码迷,mamicode.com
首页 > Web开发 > 详细

[JSOI2008]球形空间产生器sphere

时间:2019-11-09 15:45:33      阅读:101      评论:0      收藏:0      [点我收藏+]

标签:方程组   https   com   des   class   php   span   整理   pre   

Description

[JSOI2008]球形空间产生器sphere

Solution

以二维的时候为例
球面上三个点分别为\((a_1,a_2)\)\((b_1,b_2)\)\((c_1,c_2)\)
设球心的点为\((x_1,x_2)\),球的半径为\(T\)
列式得
\(\left\{ \begin{aligned} (a_1-x_1)^2+(a_2-x_2)^2&=(a_1)^2-2a_1x_1+(x_1)^2+(a_2)^2-2a_2x_2+(x_2)^2&=T\\ (b_1-x_1)^2+(b_2-x_2)^2&=(b_1)^2-2b_1x_1+(x_1)^2+(b_2)^2-2b_2x_2+(x_2)^2&=T\\ (c_1-x_1)^2+(c_2-x_2)^2&=(c_1)^2-2c_1x_1+(x_1)^2+(c_2)^2-2c_2x_2+(x_2)^2&=T \end{aligned} \right.\)
联立方程
\((a_1-x_1)^2+(a_2-x_2)^2=(b_1-x_1)^2+(b_2-x_2)^2=(c_1-x_1)^2+(c_2-x_2)^2\)
暴力展开
\((a_1)^2-2a_1x_1+(x_1)^2+(a_2)^2-2a_2x_2+(x_2)^2=(b_1)^2-2b_1x_1+(x_1)^2+(b_2)^2-2b_2x_2+(x_2)^2=(c_1)^2-2c_1x_1+(x_1)^2+(c_2)^2-2c_2x_2+(x_2)^2\)
整理得
\((a_1)^2-2a_1x_1+(a_2)^2-2a_2x_2=(b_1)^2-2b_1x_1+(b_2)^2-2b_2x_2=(c_1)^2-2c_1x_1+(c_2)^2-2c_2x_2\)
也可以写成这个样子
\(\left\{ \begin{aligned} (a_1)^2-2a_1x_1+(a_2)^2-2a_2x_2&=(b_1)^2-2b_1x_1+(b_2)^2-2b_2x_2\\ (b_1)^2-2b_1x_1+(b_2)^2-2b_2x_2&=(c_1)^2-2c_1x_1+(c_2)^2-2c_2x_2 \end{aligned} \right.\)
移来移去
\(\left\{ \begin{aligned} -2a_1x_1-2a_2x_2+2b_1x_1+2b_2x_2&=-(a_1)^2-(a_2)^2+(b_1)^2+(b_2)^2\\ -2b_1x_1-2b_2x_2+2c_1x_1+2c_2x_2&=-(b_1)^2-(b_2)^2+(c_1)^2+(c_2)^2 \end{aligned} \right.\)
移来移去
\(\left\{ \begin{aligned} (2b_1-2a_1)x_1+(2b_2-2a_2)x_2&=-(a_1)^2-(a_2)^2+(b_1)^2+(b_2)^2\\ (2c_1-2b_1)x_1+(2c_2-2b_2)x_2&=-(b_1)^2-(b_2)^2+(c_1)^2+(c_2)^2 \end{aligned} \right.\)
然后我们发现它成了一个\(n\)元一次方程组,于是我们来高斯消元就行了

Code

[JSOI2008]球形空间产生器sphere

标签:方程组   https   com   des   class   php   span   整理   pre   

原文地址:https://www.cnblogs.com/Agakiss/p/11825732.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!