Notice
Recent Posts
Recent Comments
Link
관리 메뉴

윤일무이

[백준-Python] 6749번: Next in line 본문

🥧 Python/⚙️ 코딩테스트

[백준-Python] 6749번: Next in line

썸머몽 2023. 3. 8. 14:03
728x90
 

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

 

📌 풀이

예를 들어 12, 15를 입력 받으면 18이 출력되어야 한다.

등차수열로 3씩 더한 값인데... 나는 이걸 모르고 그냥 12 + x = 15*2 뭐 이렇게 풀었다.

이래도 되고 저래도 된다.

 

✅ 코드

a = int(input())
b = int(input())
x = b+(b-a)
print(x)
728x90