风景区的面积及道路状况分析问题 test
参考文献: https://wenku.baidu.com/view/b6aed86baf1ffc4ffe47ac92.html
#include <bits/stdc++.h>
using namespace std;
const int maxn = ; double a[maxn][maxn]; int main ()
{
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
int n = ;
//int s = 0 ,t = 1,x;
//输入x 以及 y 的值
for(int i= ; i < n ; i++){
for(int j= ; j < ; j++){
cin >> a[i][j];
}
}// 读入数据 for(int j= ; j < n+ ; j++){
for(int i=j ; i < n ; i++){
a[i][j+] = 1.0* (a[i][j] - a[i-][j]) / (a[i][] - a[i-j][]);// + 0.00500000005;
}
}// 计算均差 printf("输出xi,yi及各阶均差\n");
printf(" Xi f(xi)\n");
for(int i= ; i < n ; i++){
cout << i << " ";
for(int j= ; j < i+ ; j++){
printf("%11.10lf ",a[i][j]);
}
cout << endl;
}// 打印均差表 printf("输出牛顿插值表达式\n");
printf("F%d(x)=\n",n);
for(int i= ; i < n ; i++)
{
if(i)
printf("+ ");
printf("%11.10lf",a[i][i+]);
for(int j= ; j < i ; j++)
printf("(x-%3.2lf)",a[j][]);
if(i == n)
break;
cout<< endl;
}
printf("\n");
}
牛顿插值法
0.1
6.54
4.76
5.19
6.65
4.53
9.51
4.99
12.17
2.21
15.23
6.81
17.35
6.10
19.21
8.89
22.15
4.88
23.46
3.72
27.11
3.21
28.81
2.78
29.87
3.58
30.52
2.28
30.99
2.11
32.01
2.47
33.85
2.26
34.91
1.55
37.5
样例输入1
1.7
19.89
4.80
24.52
5.98
34.82
8.83
40.54
12.18
37.67
15.21
41.38
17.92
30.00
19.50
19.68
22.23
14.56
24.56
18.86
27.31
17.98
29.11
21.62
29.87
17.98
30.87
14.86
31.51
12.86
32.89
10.96
33.78
8.68
35.71
9.54
37.5
样例输入2
输出xi,yi及各阶均差
Xi f(xi)
0.1000000000 6.5400000000
4.7600000000 5.1900000000 -0.2896995708
6.6500000000 4.5300000000 -0.3492063492 -0.0090850043
9.5100000000 4.9900000000 0.1608391608 0.1073780021 0.0123765150
12.1700000000 2.2100000000 -1.0451127820 -0.2184695549 -0.0439740293 -0.0046686449
15.2300000000 6.8100000000 1.5032679739 0.4455211112 0.0773881895 0.0115914249 0.0010746907
17.3500000000 6.1000000000 -0.3349056604 -0.3548597749 -0.1020893987 -0.0167736064 -0.0022529810 -0.0001929085
19.2100000000 8.8900000000 1.5000000000 0.4610315730 0.1158936574 0.0224724800 0.0031246884 0.0003721571 0.0000295691
22.1500000000 4.8800000000 -1.3639455782 -0.5966553288 -0.1528449280 -0.0269277140 -0.0039082432 -0.0004537375 -0.0000474925 -0.0000034949
23.4600000000 3.7200000000 -0.8854961832 0.1125763282 0.1160771943 0.0326758350 0.0052793223 0.0006586068 0.0000661716 0.0000060783 0.0000004098
27.1100000000 3.2100000000 -0.1397260274 0.1503568863 0.0047823491 -0.0114031604 -0.0037103531 -0.0006017186 -0.0000716094 -0.0000067342 -0.0000005733 -0.0000000364
28.8100000000 2.7800000000 -0.2529411765 -0.0211617101 -0.0257535430 -0.0031808221 0.0007174815 0.0003260556 0.0000557557 0.0000065992 0.0000006017 0.0000000489 0.0000000030
29.8700000000 3.5800000000 0.7547169811 0.3650935354 0.0602582286 0.0111414212 0.0013435500 0.0000500055 -0.0000188559 -0.0000042153 -0.0000005312 -0.0000000488 -0.0000000039 -0.0000000002
30.5200000000 2.2800000000 -2.0000000000 -1.6109456030 -0.5794836183 -0.0906149925 -0.0121572776 -0.0011937071 -0.0000944353 -0.0000049431 -0.0000000397 0.0000000234 0.0000000030 0.0000000003 0.0000000000
30.9900000000 2.1100000000 -0.3617021277 1.4627659574 1.4099594314 0.5127430540 0.0801272306 0.0104394240 0.0009875324 0.0000793231 0.0000053468 0.0000002862 0.0000000122 0.0000000004 0.0000000000 -0.0000000000
32.0100000000 2.4700000000 0.3529411765 0.4796263786 -0.4594110181 -0.5841782655 -0.2238614938 -0.0355542368 -0.0046646715 -0.0004415784 -0.0000355322 -0.0000024362 -0.0000001372 -0.0000000066 -0.0000000003 -0.0000000000 -0.0000000000
33.8500000000 2.2600000000 -0.1141304348 -0.1633117522 -0.1930745138 0.0669187197 0.1291859098 0.0523809204 0.0084634415 0.0011220609 0.0001068060 0.0000086266 0.0000005941 0.0000000337 0.0000000017 0.0000000001 0.0000000000 0.0000000000
34.9100000000 1.5500000000 -0.6698113208 -0.1916140986 -0.0072199863 0.0423358832 -0.0048775469 -0.0219776158 -0.0095331457 -0.0015717543 -0.0002111140 -0.0000202497 -0.0000016444 -0.0000001137 -0.0000000065 -0.0000000003 -0.0000000000 -0.0000000000 -0.0000000000
37.5000000000 6.0000000000 1.7181467181 0.6542350792 0.1540708885 0.0247758640 -0.0025157621 0.0003095393 0.0025646899 0.0011643730 0.0001948809 0.0000264492 0.0000025532 0.0000002083 0.0000000145 0.0000000008 0.0000000000 0.0000000000 0.0000000000 0.0000000000
输出牛顿插值表达式
F19(x)=
6.5400000000
+ -0.2896995708(x-0.10)
+ -0.0090850043(x-0.10)(x-4.76)
+ 0.0123765150(x-0.10)(x-4.76)(x-6.65)
+ -0.0046686449(x-0.10)(x-4.76)(x-6.65)(x-9.51)
+ 0.0010746907(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)
+ -0.0001929085(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)(x-15.23)
+ 0.0000295691(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)(x-15.23)(x-17.35)
+ -0.0000034949(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)(x-15.23)(x-17.35)(x-19.21)
+ 0.0000004098(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)(x-15.23)(x-17.35)(x-19.21)(x-22.15)
+ -0.0000000364(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)(x-15.23)(x-17.35)(x-19.21)(x-22.15)(x-23.46)
+ 0.0000000030(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)(x-15.23)(x-17.35)(x-19.21)(x-22.15)(x-23.46)(x-27.11)
+ -0.0000000002(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)(x-15.23)(x-17.35)(x-19.21)(x-22.15)(x-23.46)(x-27.11)(x-28.81)
+ 0.0000000000(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)(x-15.23)(x-17.35)(x-19.21)(x-22.15)(x-23.46)(x-27.11)(x-28.81)(x-29.87)
+ -0.0000000000(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)(x-15.23)(x-17.35)(x-19.21)(x-22.15)(x-23.46)(x-27.11)(x-28.81)(x-29.87)(x-30.52)
+ -0.0000000000(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)(x-15.23)(x-17.35)(x-19.21)(x-22.15)(x-23.46)(x-27.11)(x-28.81)(x-29.87)(x-30.52)(x-30.99)
+ 0.0000000000(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)(x-15.23)(x-17.35)(x-19.21)(x-22.15)(x-23.46)(x-27.11)(x-28.81)(x-29.87)(x-30.52)(x-30.99)(x-32.01)
+ -0.0000000000(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)(x-15.23)(x-17.35)(x-19.21)(x-22.15)(x-23.46)(x-27.11)(x-28.81)(x-29.87)(x-30.52)(x-30.99)(x-32.01)(x-33.85)
+ 0.0000000000(x-0.10)(x-4.76)(x-6.65)(x-9.51)(x-12.17)(x-15.23)(x-17.35)(x-19.21)(x-22.15)(x-23.46)(x-27.11)(x-28.81)(x-29.87)(x-30.52)(x-30.99)(x-32.01)(x-33.85)(x-34.91)
样例输出一
输出xi,yi及各阶均差
Xi f(xi)
1.70 19.89
4.80 24.52 1.49
5.98 34.82 8.73 1.69
8.83 40.54 2.01 -1.67 -0.47
12.18 37.67 -0.86 -0.46 0.16 0.06
15.21 41.38 1.22 0.33 0.09 -0.01 -0.01
17.92 30.00 -4.20 -0.94 -0.14 -0.02 -0.00 0.00
19.50 19.68 -6.53 -0.54 0.05 0.02 0.00 0.00 -0.00
22.23 14.56 -1.88 1.08 0.23 0.02 -0.00 -0.00 -0.00 -0.00
24.56 18.86 1.85 0.74 -0.05 -0.03 -0.00 -0.00 -0.00 0.00 0.00
27.31 17.98 -0.32 -0.43 -0.15 -0.01 0.00 0.00 0.00 0.00 0.00 -0.00
29.11 21.62 2.02 0.51 0.14 0.03 0.00 0.00 -0.00 -0.00 -0.00 -0.00 -0.00
29.87 17.98 -4.79 -2.66 -0.60 -0.10 -0.01 -0.00 -0.00 -0.00 -0.00 0.00 0.00 0.00
30.87 14.86 -3.12 0.95 1.01 0.26 0.04 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
31.51 12.86 -3.12 -0.00 -0.40 -0.34 -0.09 -0.01 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00
32.89 10.96 -1.38 0.87 0.29 0.18 0.09 0.02 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
33.78 8.68 -2.56 -0.52 -0.48 -0.20 -0.08 -0.03 -0.01 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00
35.71 9.54 0.45 1.07 0.38 0.18 0.06 0.02 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
37.50 6.00 -1.98 -0.65 -0.37 -0.13 -0.05 -0.01 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00 -0.00
输出牛顿插值表达式
F19(x)=
19.89
+ 1.49(x-1.70)
+ 1.69(x-1.70)(x-4.80)
+ -0.47(x-1.70)(x-4.80)(x-5.98)
+ 0.06(x-1.70)(x-4.80)(x-5.98)(x-8.83)
+ -0.01(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)
+ 0.00(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)(x-15.21)
+ -0.00(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)(x-15.21)(x-17.92)
+ -0.00(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)(x-15.21)(x-17.92)(x-19.50)
+ 0.00(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)(x-15.21)(x-17.92)(x-19.50)(x-22.23)
+ -0.00(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)(x-15.21)(x-17.92)(x-19.50)(x-22.23)(x-24.56)
+ -0.00(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)(x-15.21)(x-17.92)(x-19.50)(x-22.23)(x-24.56)(x-27.31)
+ 0.00(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)(x-15.21)(x-17.92)(x-19.50)(x-22.23)(x-24.56)(x-27.31)(x-29.11)
+ 0.00(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)(x-15.21)(x-17.92)(x-19.50)(x-22.23)(x-24.56)(x-27.31)(x-29.11)(x-29.87)
+ -0.00(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)(x-15.21)(x-17.92)(x-19.50)(x-22.23)(x-24.56)(x-27.31)(x-29.11)(x-29.87)(x-30.87)
+ 0.00(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)(x-15.21)(x-17.92)(x-19.50)(x-22.23)(x-24.56)(x-27.31)(x-29.11)(x-29.87)(x-30.87)(x-31.51)
+ -0.00(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)(x-15.21)(x-17.92)(x-19.50)(x-22.23)(x-24.56)(x-27.31)(x-29.11)(x-29.87)(x-30.87)(x-31.51)(x-32.89)
+ 0.00(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)(x-15.21)(x-17.92)(x-19.50)(x-22.23)(x-24.56)(x-27.31)(x-29.11)(x-29.87)(x-30.87)(x-31.51)(x-32.89)(x-33.78)
+ -0.00(x-1.70)(x-4.80)(x-5.98)(x-8.83)(x-12.18)(x-15.21)(x-17.92)(x-19.50)(x-22.23)(x-24.56)(x-27.31)(x-29.11)(x-29.87)(x-30.87)(x-31.51)(x-32.89)(x-33.78)(x-35.71)
样例输出二
风景区的面积及道路状况分析问题 test的更多相关文章
- Wifiner for Mac(WiFi 状况分析工具)破解版安装
1.软件简介 Wifiner 是 macOS 系统上一款 Wifi 分析工具,仅需几次点击即可对您的 Wi-Fi 网络连接进行分析和故障排除.扫描您的 Wi-Fi 网络,获取包含交互式彩色编码热 ...
- JVM内存状况查看方法和分析工具
Java本身提供了多种丰富的方法和工具来帮助开发人员查看和分析GC及JVM内存的状况,同时开源界和商业界也有一些工具可用于查看.分析GC及JVM内存的状况.通过这些分析,可以排查程序中内存泄露的问题及 ...
- BI案例:某公司BI系统的九大主题分析
1.KPI分析 KPI分析按照管理层次和时间纬度对指标进行汇总统计及分析展示,以适应各级领导的管理需求.在某公司,KPI不仅只是一个数据展示,而且已经成为一个内部考核指标的监控平台.各级领导每天上班的 ...
- Area - POJ 1265(pick定理求格点数+求多边形面积)
题目大意:以原点为起点然后每次增加一个x,y的值,求出来最后在多边形边上的点有多少个,内部的点有多少个,多边形的面积是多少. 分析: 1.以格子点为顶点的线段,覆盖的点的个数为GCD(dx,dy),其 ...
- DRDS SQL 审计与分析——全面洞察 SQL 之利器
背景 数据库存储着系统的核心数据,其安全方面的问题在传统环境中已经成为泄漏和被篡改的重要根源.而在云端,数据库所面临的威胁被进一步的放大.因此,对云数据库的操作行为尤其是全量 SQL 执行记录的审计日 ...
- 5290: [Hnoi2018]道路
5290: [Hnoi2018]道路 链接 分析: 注意题目中说每个城市翻新一条连向它的公路或者铁路,所以两种情况分别转移一下即可. 注意压一下空间,最后的叶子节点不要要访问,空间少了一半. 代码: ...
- Python大数据:信用卡逾期分析
# -*- coding:utf-8 -*- # 数据集成 import csv import numpy as np import pandas as pd import matplotlib.py ...
- 使用python抓取并分析数据—链家网(requests+BeautifulSoup)(转)
本篇文章是使用python抓取数据的第一篇,使用requests+BeautifulSoup的方法对页面进行抓取和数据提取.通过使用requests库对链家网二手房列表页进行抓取,通过Beautifu ...
- hdu 1542&&poj 1151 Atlantis[线段树+扫描线求矩形面积的并]
Atlantis Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total S ...
随机推荐
- java 泛型没有协变类型, 所以要重用extends, 但使用List<? extends Fruit> 可以是ArrayList<Fruit>()、ArrayList<Apple>()、ArrayList<Orange>(), 因此不能add元素进去
class Fruit{} class Apple extends Fruit{} class SubApple extends Apple{} class Orange extends Fruit{ ...
- [LeetCode] 438. Find All Anagrams in a String_Easy
438. Find All Anagrams in a String DescriptionHintsSubmissionsDiscussSolution Pick One Given a str ...
- [LeetCode] 221. Maximal Square _ Medium Tag: Dynamic Programming
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and re ...
- 轮廓的查找、表达、绘制、特性及匹配(How to Use Contour? Find, Component, Construct, Features & Match)
http://www.cnblogs.com/xrwang/archive/2010/02/09/HowToUseContour.html 作者:王先荣 前言 轮廓是构成任何一个形状的边界或外形 ...
- Windows程序自启动方法汇总
文件夹 一.当前用户专有的启动文件夹 二.对所有用户有效的启动文件夹 三.Load注册键 四.Userinit注册键 五.Explorer\Run注册键 六.RunServicesOnce注册键 七. ...
- c++移动构造函数
写在前面 C++中有“左值”.“右值”的概念,C++11以后,又有了“左值”.“纯右值”.“将亡值”的概念.关于这些概念,许多资料上都有介绍,本文在拾人牙慧的基础上又加入了一些自己的一些理解,同时提出 ...
- CMPXCHG指令
一.CMPXCHG汇编指令详解. 这条指令将al\ax\eax\rax中的值与首操作数比较: 1.如果相等,第2操作数的直装载到首操作数,zf置1.(相当于相减为0,所以0标志位置位) 2.如果不等, ...
- Rpgmakermv(4 )doc of TerraxLights
我只做简要翻译. To activate the script in an area, do the following: 1. Put an event switch into the map. 2 ...
- UVALive - 7261 Xiongnu's Land
思路: 先二分下界,再二分上届. #include <bits/stdc++.h> using namespace std; #define MP make_pair #define PB ...
- appium自动化测试实战
一.Appium的介绍 Appium是一款开源的自动化测试工具,其支持iOS和安卓平台上的原生的,基于移动浏览器的,混合的应用. 1. 使用appium进行自动化测试的好处 Appium在不同平台 ...