Build a solver for the monks and buns problem
R: 81 characters

i=scan();p=combn(0:i[2],2);cat(p[,p[1,]+p[2,]==i[2]&amp;i[3]*p[1,]+p[2,]/i[4]==i[1]])


A brute force solver which takes all possible combinations of non-negative integers and subset the one corresponding to criteria.