문제 링크입니다: www.acmicpc.net/problem/17874
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
간단한 구현 문제였습니다.
This file contains 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; | |
const int HEIGHT = 4; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int n, h, v; | |
cin >> n >> h >> v; | |
int result = max({ h * v, h * (n - v), (n - h) * v, (n - h) * (n - v) }) * HEIGHT; | |
cout << result << "\n"; | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 18005번 Even or Odd? (0) | 2021.03.27 |
---|---|
백준 17903번 Counting Clauses (0) | 2021.03.26 |
백준 17863번 FYI (0) | 2021.03.26 |
백준 17388번 와글와글 숭고한 (0) | 2021.03.26 |
백준 17362번 수학은 체육과목 입니다 2 (0) | 2021.03.26 |