본문 바로가기

PS_Baekjoon

[백준 C++] 6749번 : Next in line

https://www.acmicpc.net/problem/6749

 

6749번: Next in line

You know a family with three children. Their ages form an arithmetic sequence: the difference in ages between the middle child and youngest child is the same as the difference in ages between the oldest child and the middle child. For example, their ages c

www.acmicpc.net

코드 :

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    cout << b + (b-a) << '\n';
}