x1+x2=k-1
x1x2=k+2
则x1²+x2²=(x1+x2)²-2x1x2=6
k²-2k+1-2k-4=6
k²-4k-9=0
k=2±√13
有解则(k-1)²-4(k+2)>=0
k²-6k-7>=0
(k-7)(k+1)>=0
k=7
所以k=2-√13
x1+x2=k-1
x1x2=k+2
则x1²+x2²=(x1+x2)²-2x1x2=6
k²-2k+1-2k-4=6
k²-4k-9=0
k=2±√13
有解则(k-1)²-4(k+2)>=0
k²-6k-7>=0
(k-7)(k+1)>=0
k=7
所以k=2-√13