牛牛有一个数,他每次可以在该数的左边加上一个正整数(增加的数不能大于原有数的一半)来组成新的数,不停的循环加直到不能组成新的数为止。 牛牛想知道,对于给定的任意数,他最多有多少种组法?
示例1
输入
6
输出
6
说明
一共有6种组法,分别为6,16,26,126,36,136
加载中...
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回最多满足条件的组法 * @param n int整型 * @return long长整型 */ public long addLeftNumber (int n) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回最多满足条件的组法 * @param n int整型 * @return long长整型 */ long long addLeftNumber(int n) { // write code here } };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # 返回最多满足条件的组法 # @param n int整型 # @return long长整型 # class Solution: def addLeftNumber(self , n ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回最多满足条件的组法 * @param n int整型 * @return long长整型 */ public long addLeftNumber (int n) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回最多满足条件的组法 * @param n int整型 * @return long长整型 */ function addLeftNumber( n ) { // write code here } module.exports = { addLeftNumber : addLeftNumber };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # 返回最多满足条件的组法 # @param n int整型 # @return long长整型 # class Solution: def addLeftNumber(self , n ): # write code here
package main /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回最多满足条件的组法 * @param n int整型 * @return long长整型 */ func addLeftNumber( n int ) int64 { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回最多满足条件的组法 * @param n int整型 * @return long长整型 */ long long addLeftNumber(int n ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # 返回最多满足条件的组法 # @param n int整型 # @return long长整型 # class Solution def addLeftNumber(n) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回最多满足条件的组法 * @param n int整型 * @return long长整型 */ def addLeftNumber(n: Int): Long = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回最多满足条件的组法 * @param n int整型 * @return long长整型 */ fun addLeftNumber(n: Int): Long { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回最多满足条件的组法 * @param n int整型 * @return long长整型 */ public long addLeftNumber (int n) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回最多满足条件的组法 * @param n int整型 * @return long长整型 */ export function addLeftNumber(n: number): number { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回最多满足条件的组法 * @param n int整型 * @return long长整型 */ func addLeftNumber ( _ n: Int) -> Int64 { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 返回最多满足条件的组法 * @param n int整型 * @return long长整型 */ pub fn addLeftNumber(&self, n: i32) -> i64 { // write code here } }
6
6