#include <iostream>
using namespace std;

int main() {
    int a,b;cin>>a>>b;
    if(a>b){
        int tem = a;
        a = b;
        b = tem;
    }
    cout<<b+(b-a);

    return 0;
}
// 64 位输出请用 printf("%lld")

构造等差数列,将数字从小到大排序,然后输出b+(b-a)即可。

活动地址https://www.nowcoder.com/discuss/726480854079250432