We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

# Halloween party

# Halloween party

+ 17 comments Use BigInteger...if you only get wrong after testcase6, it most likely because int couldn't not hold large numbers... So use BigInteger instead...

+ 1 comment All test is perfect

static long halloweenParty(int k) { long result = k / 2; return (result * (k - result)); }

+ 0 comments Given n. find x and y such that:

- x+y=n
- x*y is maximum for all x and y

This is still not the spoiler!

Do use long long int. Else, TC 6+ would fail!

Reference: Code

+ 2 comments I feel like I'm cheating with this one. I just rounded down

`(N/2)^2`

. It passed all the tests, but I can't get over the feeling that this should not have cut it.Here's the JS:

Math.floor( Math.pow( (lines[i]/2), 2 ) )

+ 1 comment When you'll get over of how

*Big*is your*Integer*:the answer is just

;-)**int(K²/4)**

Load more conversations

Sort 249 Discussions, By:

Please Login in order to post a comment