一个长方体,长宽高都是质数,已知长宽高之和为n【n为[6,10000]范围内的自然数。】,求这个长方体的体积最大值。 输入值:长宽高之和。 输出值:体积的最大可能值。
示例1
输入
6
输出
8
说明
长宽高都为2,体积为8
示例2
输入
15
输出
125
说明
长度高可能为357,或555,故体积最大值为125
加载中...
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 得到体积的最大可能值 * @param n long长整型 长方形的长宽高之和。长宽高都为质数。 * @return long长整型 */ public long getMaxVolume (long n) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 得到体积的最大可能值 * @param n long长整型 长方形的长宽高之和。长宽高都为质数。 * @return long长整型 */ long long getMaxVolume(long long n) { // write code here } };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # 得到体积的最大可能值 # @param n long长整型 长方形的长宽高之和。长宽高都为质数。 # @return long长整型 # class Solution: def getMaxVolume(self , n ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 得到体积的最大可能值 * @param n long长整型 长方形的长宽高之和。长宽高都为质数。 * @return long长整型 */ public long getMaxVolume (long n) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 得到体积的最大可能值 * @param n long长整型 长方形的长宽高之和。长宽高都为质数。 * @return long长整型 */ function getMaxVolume( n ) { // write code here } module.exports = { getMaxVolume : getMaxVolume };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # 得到体积的最大可能值 # @param n long长整型 长方形的长宽高之和。长宽高都为质数。 # @return long长整型 # class Solution: def getMaxVolume(self , n ): # write code here
package main /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 得到体积的最大可能值 * @param n long长整型 长方形的长宽高之和。长宽高都为质数。 * @return long长整型 */ func getMaxVolume( n int64 ) int64 { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 得到体积的最大可能值 * @param n long长整型 长方形的长宽高之和。长宽高都为质数。 * @return long长整型 */ long long getMaxVolume(long long n ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # 得到体积的最大可能值 # @param n long长整型 长方形的长宽高之和。长宽高都为质数。 # @return long长整型 # class Solution def getMaxVolume(n) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 得到体积的最大可能值 * @param n long长整型 长方形的长宽高之和。长宽高都为质数。 * @return long长整型 */ def getMaxVolume(n: Long): Long = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 得到体积的最大可能值 * @param n long长整型 长方形的长宽高之和。长宽高都为质数。 * @return long长整型 */ fun getMaxVolume(n: Long): Long { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 得到体积的最大可能值 * @param n long长整型 长方形的长宽高之和。长宽高都为质数。 * @return long长整型 */ public long getMaxVolume (long n) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 得到体积的最大可能值 * @param n long长整型 长方形的长宽高之和。长宽高都为质数。 * @return long长整型 */ export function getMaxVolume(n: number): number { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 得到体积的最大可能值 * @param n long长整型 长方形的长宽高之和。长宽高都为质数。 * @return long长整型 */ func getMaxVolume ( _ n: Int64) -> Int64 { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 得到体积的最大可能值 * @param n long长整型 长方形的长宽高之和。长宽高都为质数。 * @return long长整型 */ pub fn getMaxVolume(&self, n: i64) -> i64 { // write code here } }
6
8
15
125