문제 링크입니다: www.acmicpc.net/problem/2965
2965번: 캥거루 세마리
첫째 줄에 세 캥거루의 초기 위치 A, B, C가 주어진다. (0 < A < B < C < 100)
www.acmicpc.net
간단한 구현 문제였습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
using namespace std; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int A, B, C; | |
cin >> A >> B >> C; | |
int result = max(B - (A + 1), C - (B + 1)); | |
cout << result << "\n"; | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 2985번 세 수 (0) | 2021.05.10 |
---|---|
백준 2975번 Transactions (0) | 2021.05.09 |
백준 2959번 거북이 (0) | 2021.05.07 |
백준 2953번 나는 요리사다 (0) | 2021.05.05 |
백준 21611번 마법사 상어와 블리자드 (0) | 2021.05.03 |