题解 | #牛牛学数列#
牛牛学数列
http://www.nowcoder.com/practice/0b97367cd2184c12a0e02f7c223aee11
int main()
{
int a = 0, b = 0;
scanf("%d", &a);
int c = a;
for (; c > 0; c--)
{
a = c;
if (a % 2 == 0)
{
a *= -1;
}
b += a;
}
printf("%d\n", b);
return 0;
}