This type of question can be solved by writing a system of expressions. I'll start you off:
for 20 heads, that means Cows + Ducks = 20.
Hopefully that helps you get started towards an answer. If you're still having difficulty solving this type of problem, feel free to schedule a tutoring session.