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
'🥧 Python > ⚙️ 코딩테스트' 카테고리의 다른 글
[백준-Python] 6810번: ISBN (0) | 2023.03.08 |
---|---|
[백준-Python] 6778번: Which Alien? (0) | 2023.03.08 |
[백준-Python] 5522번: 카드 게임 (0) | 2023.03.07 |
[백준-Python] 5217번: 쌍의 합 (0) | 2023.03.07 |
[백준-Python] 4892번: 숫자 맞추기 게임 (0) | 2023.03.06 |