PS/Baekjoon Online Judge
[백준 17874] Piece of Cake! [Python]
kimyoungrok
2023. 5. 1. 15:53
728x90


풀이
정수 n, h, v 입력받고, 길이가 n인 정사각형 케이크에서 각각 가로/세로로 h와 v에서 케이크를 잘라 4등분 할 때,
가장 부피가 큰 케이크의 부피를 풀력해주면 된다. 참고로 케이크의 높이는 4 이다.
가로/세로가 최댓값인 경우를 계산해주자.
소스코드
출처
17874번: Piece of Cake!
The input consists of a single line containing three integers n (2 ≤ n ≤ 10 000), the length of the sides of the square cake in centimeters, h (0 < h < n), the distance of the horizontal cut from the top edge of the cake in centimeters, and v (0 < v <
www.acmicpc.net
728x90