解由f(x)=-cos^2x+cosx+m
=-(cosx-1/2)^2+m+1/4
故知当cosx=1/2是,y=f(x)有最大值m+1/4
当当cosx=-1是,y=f(x)有最小值m-2
故函数的值域为[m-2,m+1/4]
即m-2≤f(x)≤m+1/4
又由1≤f(x)≤5恒成立
故m-2≥1且m+1/4≤5
即3≤m≤19/4.
解由f(x)=-cos^2x+cosx+m
=-(cosx-1/2)^2+m+1/4
故知当cosx=1/2是,y=f(x)有最大值m+1/4
当当cosx=-1是,y=f(x)有最小值m-2
故函数的值域为[m-2,m+1/4]
即m-2≤f(x)≤m+1/4
又由1≤f(x)≤5恒成立
故m-2≥1且m+1/4≤5
即3≤m≤19/4.