Ta có : \(a^3+b^3+3\left(a^2+b^2\right)+4\left(a+b\right)+4=0\)
\(=>\left(a+1\right)^3+\left(b+1\right)^3+a+b+2=0\)
\(=>\left(a+b+2\right)\left[\left(a+1\right)^2-\left(a+1\right)\left(b+1\right)+\left(b+1\right)^2\right]+\left(a+b+2\right)=0\)
\(=>\left(a+b+2\right)\left(a^2+b^2+a+b-ab+2\right)=0\)
\(=>\left(a+b+2\right)2\left(a^2+b^2+a+b-ab+2\right)=0\)
\(=>\left(a+b+2\right)\left(2a^2+2b^2+2a+2b-2ab+4\right)=0\)
\(=>\left(a+b+2\right)\left[\left(a-b\right)^2+\left(a+1\right)^2+\left(b+1\right)^2+2\right]=0\)
Lại có : \(\left(a-b\right)^2\ge0;\left(a+1\right)^2\ge0;\left(b+1\right)^2\ge0\)
\(=>\left(a-b\right)^2+\left(a+1\right)^2+\left(b+1\right)^2+2\ge0\)
\(=>a+b+2=0=>a+b=-2=>M=2018.\left(-2\right)^2=8072\)