已知数列{an}是各项均不为0的等差数列,前n项和为Sn,且(an)^2=S2n-1,求an