P
Petrakid
Hey, I have a task to complete. I am trying to figure out the best
way, in C++ to determine the following. There is this farm with pigs
and chickens. Only the legs of the pigs and chickens look exactly the
same, so for a short person to determine how many possible pigs and how
many possible chickens, all they can do is count the total legs of the
two.
- Chickens seem to always run around in groups of 3
- Pigs seem to always clump together in groups of 8
- pigs ALWAYS have 4 legs and chickens ALWAYS have 2 legs
I need to figure out the total number of possibilities ( like there are
300 different possibilities) AND list the possibilities at the users
request (8 pigs and 3 chicken or 600 pigs and 89 chickens, etc).
I CANNOT use arrays or the exact chinese remainder theorem (i can use a
variation of it).
this is an assignment, so I don't need the complete answer. I'm having
the most trouble with the calculation steps.
I've already determined that there will be 2 calculation functions,
though if it can be done with 1 calculation function, that's great.
If yo could help me out, I would appreciate it!!!!!
way, in C++ to determine the following. There is this farm with pigs
and chickens. Only the legs of the pigs and chickens look exactly the
same, so for a short person to determine how many possible pigs and how
many possible chickens, all they can do is count the total legs of the
two.
- Chickens seem to always run around in groups of 3
- Pigs seem to always clump together in groups of 8
- pigs ALWAYS have 4 legs and chickens ALWAYS have 2 legs
I need to figure out the total number of possibilities ( like there are
300 different possibilities) AND list the possibilities at the users
request (8 pigs and 3 chicken or 600 pigs and 89 chickens, etc).
I CANNOT use arrays or the exact chinese remainder theorem (i can use a
variation of it).
this is an assignment, so I don't need the complete answer. I'm having
the most trouble with the calculation steps.
I've already determined that there will be 2 calculation functions,
though if it can be done with 1 calculation function, that's great.
If yo could help me out, I would appreciate it!!!!!