6 Replies - 1382 Views - Last Post: 16 March 2013 - 05:55 PM

#1 jamal antonio  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 23-June 10

Working out 5 weights from 10 combo weights

Posted 16 March 2013 - 04:00 PM

I'm trying to write a problem to solve the problem outlined here: http://www.hpcodewar...ghtyProblem.pdf

I've come up with 5 different formulae to work out each child's weight.

First off you organise the inputs into an ordered list in an array, then put them into the following formulas. The 5 children are labelled a to e and for the sake of ease of reading the array starts at 1, being the lowest valued input and ends at 10 being the highest.

a = (1 + 2 - 3) / 2
b = (1 + 3 - 2) / 2
c = (2 + 3 - 1) / 2
d = (4 + 6 - 1) / 2
e = (5 + 7 - 1) / 2

EDIT: I've just realised that these formulae only work for the first set of test data, guess I should have checked that first, now I'm really stuck...

However I am far from satisfied with this answer and I'm thinking that there must be better and more general equation so I don't have to have 5. How can I tackle this?

This post has been edited by jamal antonio: 16 March 2013 - 04:14 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Working out 5 weights from 10 combo weights

#2 jamal antonio  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 23-June 10

Re: Working out 5 weights from 10 combo weights

Posted 16 March 2013 - 04:45 PM

I can't edit again yet, so sorry for the double post but I have got half of a new solution:

(1+2+3+4+5+6+7+8+9+10)/2 = a+b+c+d+e = x
[heaviest]: d+e = 10 => x-10 = a+b+c
[lightest]: a+b = 1 => x-1 = c+d+e
Was This Post Helpful? 0
  • +
  • -

#3 jamal antonio  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 23-June 10

Re: Working out 5 weights from 10 combo weights

Posted 16 March 2013 - 05:12 PM

I can't edit again, silly system, if a mod could merge these posts, I'd appreciate it.

I have a solution:
a = 1+2+10-x
b = x-2-10
c = x-10-1
d = x-9-1
e = 10+9+1-x

But again, 5 separate formulas...
Was This Post Helpful? 0
  • +
  • -

#4 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2216
  • View blog
  • Posts: 9,352
  • Joined: 29-May 08

Re: Working out 5 weights from 10 combo weights

Posted 16 March 2013 - 05:25 PM

It not a silly system as prevents some poster nuking the contents of their post once try have a solution, which kills the flow of the thread.
Was This Post Helpful? 1
  • +
  • -

#5 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3394
  • View blog
  • Posts: 9,592
  • Joined: 08-June 10

Re: Working out 5 weights from 10 combo weights

Posted 16 March 2013 - 05:48 PM

View Postjamal antonio, on 17 March 2013 - 01:12 AM, said:

But again, 5 separate formulas...

I donít see what the problem is with that.
Was This Post Helpful? 0
  • +
  • -

#6 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10185
  • View blog
  • Posts: 37,603
  • Joined: 27-December 08

Re: Working out 5 weights from 10 combo weights

Posted 16 March 2013 - 05:49 PM

Moved to Software Development.
Was This Post Helpful? 0
  • +
  • -

#7 jamal antonio  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 23-June 10

Re: Working out 5 weights from 10 combo weights

Posted 16 March 2013 - 05:55 PM

View PostDormilich, on 16 March 2013 - 05:48 PM, said:

View Postjamal antonio, on 17 March 2013 - 01:12 AM, said:

But again, 5 separate formulas...

I don’t see what the problem is with that.


The problem is, what if you want to find the separate weights of 4 people, or 20 people? The program can't do that, hence me wanting to find a more general formula.

View Postmacosxnerd101, on 16 March 2013 - 05:49 PM, said:

Moved to Software Development.

Thanks, I didn't think it would go here, sorry.

This post has been edited by jamal antonio: 16 March 2013 - 05:57 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1