Sicily 1466. Taunt Exposure Estimation
来源:互联网 发布:越南经济数据网站 编辑:程序博客网 时间:2024/06/06 04:25
1466. Taunt Exposure Estimation
Constraints
Time Limit: 5 secs, Memory Limit: 32 MB
Description
The brave knights (kə’ nig’ əts) 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
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
// Problem#: 1466// Submission#: 3316720// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/// All Copyright reserved by Informatic Lab of Sun Yat-sen University#include <iostream>#include <vector>#include <algorithm>#include <stdio.h>#include <math.h>#include <string.h>#include <string>#include <queue>#include <set>#include <iomanip>#include <map>using namespace std;const int MAX_N = 10000;int main() { //std::cout.sync_with_stdio(false); int n; scanf("%d", &n); double xy[MAX_N][2]; char temp; for (int i = 0; i < n; i++) { scanf("%lf%c%lf", &xy[i][0], &temp, &xy[i][1]); } double ans = 0; for (int i = 1; i < n; i++) ans += (xy[i][1] + xy[i - 1][1]) * (xy[i][0] - xy[i - 1][0]) / 2; printf("%.2lf to %.2lf: %.4lf\n", xy[0][0], xy[n - 1][0], ans); return 0;}
- Sicily 1466. Taunt Exposure Estimation
- HDU 3132 Taunt Exposure Estimation(数学)
- Exposure
- Estimation
- 曝光(Exposure)
- 曝光补偿 (Exposure compensation)
- 辐照 radiation exposure
- Exposure Value(曝光量)
- [IETF] Congestion Exposure
- DockerInAction-Network exposure
- 包围曝光(Bracket Exposure)
- ZSL exposure feature in camera
- Curve Estimation
- Software Estimation
- motion estimation
- Depth Estimation
- B 门曝光模式(Bulb Exposure)
- Terminology on radiological protection of medical exposure
- 陶昕然与相恋8年的男友何建泽领证 安小主终收获爱情
- C - Catch That Cow POJ3278
- 如何在Linux下使用rsync
- 如何为自己的php版本选择正确的xdebug版本
- 2015 完整安装 LNMP
- Sicily 1466. Taunt Exposure Estimation
- 常用Hibernate 主键生成策略(徐瑞文)
- 开源界迎来新杀手,用互联网思维攻克企业级市场!
- 【JAVA】点名小系统
- swift开发基础之变量和常量
- Sicily 1463. The Brave Sir Robin’s cAsE cOrReCtOr
- Core Data 属性介绍
- LayoutInflater
- Sicily 1453. Conformity