编程介的小学生 2018-11-30 15:06 采纳率: 20.5%
浏览 375
已采纳

用C++语言,Taunt Exposure Estimation怎么做?

Problem Description
The brave knights of Camelot are constantly exposed to French taunting while assaulting the castle occupied by the French. Consequently, the taunting to which they are exposed varies with their distance from the castle during their assault, as well as variations in French taunting activity. We need to estimate the total amount of taunting that they are exposed to during a certain time period. Unfortunately, we only have access to a set of measurements at random times — we do not have a continuous reading — and, because of flaws in our archaic equipment, the measurements of taunting occur at unpredictable intervals.

The total amount of taunting will be given by the integral of the taunting intensity during the time period, as held in the observation data file. The amount of random noise, though, is fairly high, so that a simple trapezoid-rule integration is all that is merited.

Input
A single number, n, specifying the number of data points in the file

n pairs of floating point numbers (given in increasing x order), separated by a comma — in other words, a CSV file that could be input for a spreadsheet program [the first number is the x coordinate (time specification), the second is the y coordinate (the radiation reading)]

Output
A single line of text giving the first and last x values (with two digits to the right of the decimal point), and the computed integral (with four digits to the right of the decimal point), in the fashion shown below (which reflects the data shown in the graph):

0.00 to 365.25: 2099.8021

[A reasonable value for the given input, (shown in the graph above), since the values range around 5 3/4, and 365.25 * 5.75 gives 2100.1875.]

Sample Input
9
0.0000, 0.5176
0.9869, 1.000
1.596, 1.114
2.370, 1.006
2.904, 0.8481
3.506, 0.5760
3.996, 0.4775
5.004, 0.3945
6.283, 1.004

Sample Output
0.00 to 6.28: 4.7288

  • 写回答

1条回答 默认 最新

  • threenewbee 2019-02-22 22:59
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧