백준: 17874번 Piece of Cake! (Python3)
Piece of Cake! 성공다국어
1 초 | 512 MB | 832 | 731 | 699 | 88.593% |
문제
It is Greg’s birthday! To celebrate, his friend Sam invites Greg and two other friends for a small party. Of course, every birthday party must have cake.
Sam ordered a square cake. She makes a single horizontal cut and a single vertical cut. In her excitement to eat cake, Sam forgot to make these cuts through the middle of the cake.
Of course, the biggest piece of cake should go to Greg since it is his birthday. Help Sam determine the volume of the biggest piece of cake that resulted from these two cuts.
입력
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 < n), the distance of the vertical cut from the left edge of the cake in centimeters. This is illustrated in the figure above.
Each cake is 4 centimeters thick.
출력
Display the volume (in cubic centimeters) of the largest of the four pieces of cake after the horizontal and vertical cuts are made.
예제 입력 1
10 4 7
예제 출력 1
168
예제 입력 2
5 2 2
예제 출력 2
36
예제 입력 3
4 2 1
예제 출력 3
24
답안
1
2
3
|
n, h, v = map(int, input().split())
res = max(h, n-h) * max(v, n-v)
print(res*4)
|
cs |
'공부 > 코딩테스트' 카테고리의 다른 글
백준: 25191번 치킨댄스를 추는 곰곰이를 본 임스 (Python3) (0) | 2022.08.08 |
---|---|
백준: 25377번 빵 (Python3) (0) | 2022.08.08 |
백준: 17903번 Counting Clauses (Python3) (0) | 2022.08.07 |
백준: 18198번 Basketball One-on-One (Python3) (0) | 2022.08.07 |
백준: 18330번 Petrol (Python3) (0) | 2022.08.07 |
댓글