拆分为两个等差求和
①当n为奇数时
1-2+3-4+5-6+...+(-1)^(n+1)×n
=(1+3+5+…+n)-(2+4+6+…+(n-1))
=((1+n)×((n+1)/2)/2)-((2+n-1)×((n-1)/2)/2)
=(n+1)^2/4-(n^2-1)/4
=(n+1)/2
②当n为偶数时.
1-2+3-4+5-6+...+(-1)^(n+1)×n
=(1+3+5+…+n-1)-(2+4+6+…+n)
=((1+n-1)×(n/2)/2-((2+n)×(n/2)/2)
= -2n/4
= -n/2