HS Thomas

Ranch Hand

Posts: 3404

Jason Menard

Sheriff

Posts: 6450

posted 14 years ago

6 ostriches and 11 pigs.

The Math:

x = # of ostrich legs, x/2 = # of ostriches

y = # of pig legs, y/4 = # of pigs

x + y = 56

x/2 + y/4 = 17

y = 56 - x

x/2 + (56 - x)/4 = 17

4(x/2 + (56 - x)/4) = 4 * 17

2x + 56 - x = 68

x = 12

y = 56 - 12 = 44

x/2 = 6

y/4 = 11

[ September 10, 2003: Message edited by: Jason Menard ]

The Math:

x = # of ostrich legs, x/2 = # of ostriches

y = # of pig legs, y/4 = # of pigs

x + y = 56

x/2 + y/4 = 17

y = 56 - x

x/2 + (56 - x)/4 = 17

4(x/2 + (56 - x)/4) = 4 * 17

2x + 56 - x = 68

x = 12

y = 56 - 12 = 44

x/2 = 6

y/4 = 11

[ September 10, 2003: Message edited by: Jason Menard ]

HS Thomas

Ranch Hand

Posts: 3404

posted 14 years ago

Congrats.

I did it the usual (longer) way using math.

Here is a solution that uses pure logic.

Each animal has two hind legs, so 17 heads means 34 hind legs total.

The remaining 22 legs must be the front legs of 11 four-legged pigs.

Therefore 11 heads belong to the pigs and the remaining 6 heads belong to ostriches.

regards

I did it the usual (longer) way using math.

Here is a solution that uses pure logic.

Each animal has two hind legs, so 17 heads means 34 hind legs total.

The remaining 22 legs must be the front legs of 11 four-legged pigs.

Therefore 11 heads belong to the pigs and the remaining 6 heads belong to ostriches.

regards

It is sorta covered in the JavaRanch Style Guide. |