#232. 平均数

平均数

题目描述

已知R1R_1R2R_2的平均数为SS,即R1+R22=S\frac{R_1+R_2}{2}=S。现在已知R1R_1SS,求R2R_2

输入格式

输入两个整数R1R_1SS,范围[1000,1000][-1000,1000]

输出格式

输出R2R_2的值

样例

输入1

11 15

输出1

19

输入2

4 3

输出2

2

数据范围与提示

无特殊限制

参考代码

#include <iostream>
using namespace std;

int main() {
    int R1, S;
    cin >> R1 >> S;
    cout << 2 * S - R1 << endl;
    return 0;
}