测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A1113. [COCI-2007_2008-contest3]#1 CETIRI

编程题 普及/提高-

题目描述

Mirko has chosen four integers which form an arithmetic progression. In other words, when the four numbers are sorted, then the difference between each pair of adjacent elements is constant.
As has become usual, Mirko lost one of the numbers and also is not sure whether the remaining three are in the correct (sorted) order.
Write a program that, given the three remaining numbers, finds the fourth number.

输入格式

The input contains 3 integers between −100 and 100 on a single line, separated by single spaces.
Note: the input data will guarantee that a solution, although not necessarily unique, will always exist.

输出格式

Output any number which could have been the fourth number in the sequence.

输入输出样例

输入 #1
4 6 8
输出 #1
10
输入 #2
10 1 4
输出 #2
7
上一题 去做题 下一题