Lời giải:
Với $x-y=-3$ thì:
\(E=x^2(x+1)-y^2(y-1)+xy-3(x-y-1)+2017\)
\(=x^3+x^2-y^3+y^2+xy-3xy(-3-1)+2017\)
\(=(x^3-y^3)+x^2+y^2+13xy+2017\)
\(=(x-y)(x^2+xy+y^2)+x^2+y^2+13xy+2017\)
\(=-3(x^2+xy+y^2)+x^2+y^2+13xy+2017\)
\(=-2x^2-2y^2+10xy+2017\)
\(=-2(x^2+y^2-2xy)+6xy+2017=-2(x-y)^2+6xy+2017\)
\(=-2(-3)^2+6xy+2017=6xy+1999\)