Ta có : \(a+b+c=3\Rightarrow\left(a+b+c\right)^2=9\)
\(\Rightarrow a^2+b^2+c^2+2\left(ab+bc+ca\right)=9\)
\(\Rightarrow a^2+b^2+c^2=9-2\left(ab+bc+ca\right)=9-2.3=3\)
\(\Rightarrow a^2+b^2+c^2=ab+bc+ca\)
\(\Leftrightarrow a^2+b^2+c^2-ab-bc-ca=0\)
\(\Leftrightarrow2a^2+2b^2+2c^2-2ab-2bc-2ca=0\)
\(\Leftrightarrow\left(a^2-2ab+b^2\right)+\left(b^2-2bc+c^2\right)+\left(c^2-2ca+a^2\right)=0\)
\(\Leftrightarrow\left(a-b\right)^2+\left(b-c\right)^2+\left(c-a\right)^2=0\)
\(\Leftrightarrow a=b=c\)
Mà \(a+b+c=3\Rightarrow a=b=c=1\)
\(\Rightarrow M=\left(1-1-1\right)^{2018}+\left(1-1-1\right)^{2019}+\left(1-1-1\right)^{2020}=1-1+1=1\)
Vậy \(M=1\)