Challenge 4 - Balancing act!

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Challenge 4 - Balancing act!

Post by avansc »

i also have no idea why both of you sort the numbers. there is no reason to do that. that does not make it computationally any easier.
try to think about all the sets you have to test. think about innovative ways to cut down on testing. and just get a notepad and make some notes.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Challenge 4 - Balancing act!

Post by MarauderIIC »

Because with a consecutive set, anyway, get the highest #, get the lowest #, get the next highest, next lowest... if # of elements is even, this gives you two equal sets. If # of elements is odd, save the lowest one and add it to the most disadvantaged set (if it's 1, then your difference now is just 1).

*shrug* I wasn't considering nonconsecutive sets at the time (obviously) due to time constraints =)
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
cypher1554R
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1124
Joined: Sun Jun 22, 2008 5:06 pm

Re: Challenge 4 - Balancing act!

Post by cypher1554R »

That's it.. I have no idea what you're talking about or how to do it. I give up.

And JEEEZ... I was just trying to be humorous with my comments. The way you respond, is like you're cold dead serious about it. The reason I try these challenges is just to get some steam off. I don't care if I get it right or wrong. If it's wrong, you don't have to be douche about it, just say it's wrong.. :|

komrade..
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Challenge 4 - Balancing act!

Post by avansc »

cypher1554R wrote:That's it.. I have no idea what you're talking about or how to do it. I give up.

And JEEEZ... I was just trying to be humorous with my comments. The way you respond, is like you're cold dead serious about it. The reason I try these challenges is just to get some steam off. I don't care if I get it right or wrong. If it's wrong, you don't have to be douche about it, just say it's wrong.. :|

komrade..
sorry, i had a rough night last night. i was working on a big project. a appologize guys. sometimes when i cant get my own projects to work i become a little bitch. im sorry.

okay. let the sane comrade help.

okay, i got this challenge out an old book, i had never done it so it was a bit challenging to me. but what i had done war write a brute force password guesser for a ftp server, and in many ways this challenge is same.

here is an image to illistrate, why i said permutation
Image

you keep moving the last element to the next number, when it reaches the end you move the previose element one up, and move the lase element +1 possition of the, however, if the last position is in the last combination and the previouse element is next to it, you have to move the element befor those on up and have then follow it.

at the beginning you add all the numbers together, thats your devisor.
then after each iteration you add all the selected numbers, devide them by the devisor, and you get a ratio. which ever of the combinations give you the closest ration to .50 will be a make up of one team. because that .50 represents fifty percent of the weigt of all the players.


anyways. once again guys. im sorry if i was rude. just had one of those nights were you wanna punch your code liver.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Post Reply