Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Simple calculations
Description There is a sequence of n+2 elements a _{0}, a_{1}, ..., a_{n+1} (n <= 3000, -1000 <= a_{i} <=1000). It is known that afor each i=1, 2, ..., n.
_{i} = (a_{i-1} + a_{i+1})/2 - c_{i} You are given a _{0}, a_{n+1}, c_{1}, ... , c_{n}. Write a program which calculates a_{1}.Input The first line of an input contains an integer n. The next two lines consist of numbers a _{0} and a_{n+1} each having two digits after decimal point, and the next n lines contain numbers c_{i} (also with two digits after decimal point), one number per line.Output The output file should contain a _{1} in the same format as a_{0} and a_{n+1}.Sample Input 1 50.50 25.50 10.15 Sample Output 27.85 Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator