Sol

设一个dis,就有n+1个方程,消掉dis,就只有n个方程,组成一个方程组,高斯消元就好(建议建立方程时推一下,很简单)

# include <bits/stdc++.h>
# define RG register
# define IL inline
# define Fill(a, b) memset(a, b, sizeof(a))
using namespace std;
typedef long long ll; int n;
double a[20][20], b[20][20], ans[20], sqr[20]; int main(RG int argc, RG char *argv[]){
scanf("%d", &n);
for(RG int i = 0; i <= n; ++i)
for(RG int j = 1; j <= n; ++j)
scanf("%lf", &b[i][j]), sqr[i] += b[i][j] * b[i][j];
for(RG int i = 1; i <= n; ++i){
for(RG int j = 1; j <= n; ++j)
a[i][j] = 2 * (b[i][j] - b[0][j]);
a[i][n + 1] = sqr[i] - sqr[0];
}
for(RG int i = 1; i < n; ++i)
for(RG int j = i + 1; j <= n; ++j){
RG double div = a[j][i] / a[i][i];
for(RG int k = 1; k <= n + 1; ++k) a[j][k] -= a[i][k] * div;
}
for(RG int i = n; i; --i){
ans[i] = a[i][n + 1] / a[i][i];
for(RG int j = 1; j < i; ++j) a[j][n + 1] -= ans[i] * a[j][i];
}
for(RG int i = 1; i <= n; ++i){
printf("%.3lf", ans[i]);
if(i != n) putchar(' ');
}
return 0;
}

[JSOI2008]球形空间产生器sphere的更多相关文章

  1. 【bzoj1013】[JSOI2008]球形空间产生器sphere

    1013: [JSOI2008]球形空间产生器sphere Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 4530  Solved: 2364[Subm ...

  2. BZOJ 1013: [JSOI2008]球形空间产生器sphere 高斯消元

    1013: [JSOI2008]球形空间产生器sphere Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/Judg ...

  3. 【BZOJ】1013: [JSOI2008]球形空间产生器sphere

    [BZOJ]1013: [JSOI2008]球形空间产生器sphere 题意:给n+1个n维的点的坐标,要你求出一个到这n+1个点距离相等的点的坐标: 思路:高斯消元即第i个点和第i+1个点处理出一个 ...

  4. bzoj 1013 [JSOI2008]球形空间产生器sphere(高斯消元)

    1013: [JSOI2008]球形空间产生器sphere Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 3584  Solved: 1863[Subm ...

  5. 线性代数(高斯消元):JSOI2008 球形空间产生器sphere

    JSOI2008 球形空间产生器sphere [题目描述] 有一个球形空间产生器能够在n维空间中产生一个坚硬的球体.现在,你被困在了这个n维球体中,你只知道球面上n+1个点的坐标,你需要以最快的速度确 ...

  6. BZOJ 1013 [JSOI2008]球形空间产生器sphere

    1013: [JSOI2008]球形空间产生器sphere Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 3074  Solved: 1614[Subm ...

  7. BZOJ1013 [JSOI2008]球形空间产生器sphere(高斯消元)

    1013: [JSOI2008]球形空间产生器sphere Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 4846  Solved: 2525[Subm ...

  8. bzoj千题计划104:bzoj1013: [JSOI2008]球形空间产生器sphere

    http://www.lydsy.com/JudgeOnline/problem.php?id=1013 设球心(x1,x2,x3……) 已知点的坐标为t[i][j] 那么 对于每个i满足 Σ (t[ ...

  9. BZOJ1013 JSOI2008 球形空间产生器sphere 【高斯消元】

    BZOJ1013 JSOI2008 球形空间产生器sphere Description 有一个球形空间产生器能够在n维空间中产生一个坚硬的球体.现在,你被困在了这个n维球体中,你只知道球面上n+1个点 ...

  10. lydsy1013: [JSOI2008]球形空间产生器sphere 高斯消元

    题链:http://www.lydsy.com/JudgeOnline/problem.php?id=1013 1013: [JSOI2008]球形空间产生器sphere 时间限制: 1 Sec  内 ...

随机推荐

  1. 设置修改CentOS系统时区

    一.时区 1. 查看当前时区date -R 2. 修改设置时区方法(1)tzselect方法(2) 仅限于RedHat Linux 和 CentOS系统timeconfig方法(3) 适用于Debia ...

  2. 广告中的AdNetwork、AdExchange、DSP、SSP、RTB和DMP是什么?

    [https://www.douban.com/note/557732418/?type=rec] AdNetwork.AdExchange.DSP.SSP.RTB.DMP这些模式之间存在着内在的关系 ...

  3. eslint 入门项目搭建过程

    github 地址 : https://github.com/gebin/eslint-demo 运行该项目 npm install npm start 访问 http://localhost:900 ...

  4. 【应知应会】15个常用的JavaScript字符串操作方法

    1 初始化 //常用初始化方法 var stringVal = "hello iFat3"; //构造函数创建方法 var stringObj = new String(" ...

  5. Django——ContentType及ContentType-signals的使用

    一.ContentType 在django中,有一个记录了项目中所有model元数据的表,就是ContentType,表中一条记录对应着一个存在的model,所以可以通过一个ContentType表的 ...

  6. eclipse设置git忽略文件

    使用eclipse开发的程序员们经常会接触版本控制软件,这里只要说下eclipse使用egit的情况下设置忽略文件. 特此说明在这里使用window->team->ignored对于git ...

  7. 《android开发艺术探索》读书笔记(四)--View工作原理

    接上篇<android开发艺术探索>读书笔记(三) No1: View的三大流程:测量流程.布局流程.绘制流程 No2: ViewRoot对应于ViewRootImpl类,它是连接Wind ...

  8. uva10603 倒水问题

    状态搜索.类似八数码问题 AC代码 #include<cstdio> #include<queue> #include<cstring> #include<a ...

  9. scrapy安装的问题

    Found existing installation: six 1.4.1 DEPRECATION: Uninstalling a distutils installed project (six) ...

  10. Mysql group by,order by,dinstict优化

    1.order by优化 2.group by优化 3.Dinstinct 优化 1.order by优化 实现方式: 1. 根据索引字段排序,利用索引取出的数据已经是排好序的,直接返回给客户端: 2 ...