Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object Cube {
- def helper(sum:BigInt,m:Long,n:BigInt):BigInt=
- {
- if(sum+(n*n*n)<m) helper(sum+(n*n*n),m,n+1)
- else if (m==sum+(n*n*n)) n
- else -1
- }
- def findNb(m: Long):BigInt =
- helper(0,m,1)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement