ABC memorandum [ABC159 C --Maximum Volume] (Python)

Problem statement

Given a positive integer $ L $. Find the maximum volume that can be a rectangular parallelepiped whose total length, width, and height (which do not have to be integers).

Constraints

1≤L≤1000 $ L $ is an integer

C - Maximum Volume

solution

If the length, width, and height are set to $ a, b, and c $, respectively, the problem is to find the maximum value using the additive geometric mean of the three variables.

L = int(input())
a = L / 3

print(a ** 3)

Additive geometric mean of 3 variables

When $ a, b, c \ geq0 $, $ a + b + c \ geq3 \ sqrt [3] {abc} $ holds, and when $ a = b = c $, the equal sign holds. When this inequality is transformed, it becomes $ (\ frac {a + b + c} {3}) ^ 3 \ geq abc $, and $ abc $ becomes the maximum when the equal sign holds.

Recommended Posts

ABC memorandum [ABC159 C --Maximum Volume] (Python)
ABC memorandum [ABC163 C --managementr] (Python)
ABC memorandum [ABC161 C --Replacing Integer] (Python)
ABC memorandum [ABC158 C --Tax Increase] (Python)
ABC memorandum [ABC157 C --Guess The Number] (Python)
ABC147 C --HonestOrUnkind2 [Python]
ABC memorandum [ABC160 C --Traveling Salesman around Lake] (Python)
ABC163 C problem with python3
ABC188 C problem with python3
ABC187 C problem with python
Solve ABC163 A ~ C with Python
Python memorandum
ABC127 A, B, C Explanation (python)
Python Memorandum 2
ABC166 in Python A ~ C problem
Solve ABC168 A ~ C with Python
Python memorandum
Solve ABC036 A ~ C in Python
python memorandum
python memorandum
Solved AtCoder ABC 114 C-755 with Python3
Solve ABC162 A ~ C with Python
Solve ABC167 A ~ C with Python
ABC128 A, B, C commentary (python)
Solve ABC158 A ~ C with Python
ABC126 A, B, C Explanation (python)
Solve ABC037 A ~ C in Python
Python memorandum
python memorandum
Python memorandum
Solve ABC175 A, B, C in Python
Algorithm in Python (ABC 146 C Binary Search
Beginner ABC154 (Python)
Beginner ABC156 (Python)
Python basics memorandum
Python pathlib memorandum
Python memorandum (algorithm)
AtCoder ABC 174 Python
AtCoder ABC187 Python
AtCoder ABC188 Python
Beginner ABC155 (Python)
python C ++ notes
python, openFrameworks (c ++)
Beginner ABC157 (Python)
Python memorandum [links]
AtCoder ABC 175 Python
Challenge AtCoder (ABC) 164 with Python! A ~ C problem
Python memorandum numbering variables
Python C / C ++ Extension Pattern-Pointer
python memorandum (sequential update)
Python memorandum (personal bookmark)
Next Python in C
Python basic memorandum part 2
Solve ABC169 in Python
Solve Atcoder ABC176 (A, B, C, E) in Python
C API in Python 3
[Python] Iterative processing_Personal memorandum
Memorandum @ Python OR Seminar
python memorandum super basic
[AtCoder explanation] Control ABC180 A, B, C problems with Python!
[AtCoder explanation] Control ABC188 A, B, C problems with Python!