// // How many solutions are there for the equation x + y + z = 11 // where x, y and z are positive integers? // import org.chocosolver.solver.Model; import org.chocosolver.solver.Solver; import org.chocosolver.solver.variables.IntVar; public class XYZ11 { public static void main(String args[]){ Model model = new Model("x+y+z=11"); Solver solver = model.getSolver(); IntVar x = model.intVar("x",0,11); IntVar y = model.intVar("y",0,11); IntVar z = model.intVar("z",0,11); model.sum(new IntVar[]{x,y,z},"=",11).post(); while(solver.solve()) System.out.println(x +" "+ y +" "+ z); System.out.println(solver.getMeasures()); } }