题解 | #牛牛学数列#
牛牛学数列
http://www.nowcoder.com/practice/0b97367cd2184c12a0e02f7c223aee11
#include <stdio.h>
int main(){
int a;
scanf("%d",&a);
if(a%2==0){
printf("%d",(-1*a)/2);
}
else if(a%2!=0){
printf("%d",(-1*(a-1))/2+a);
}
}
int main(){
int a;
scanf("%d",&a);
if(a%2==0){
printf("%d",(-1*a)/2);
}
else if(a%2!=0){
printf("%d",(-1*(a-1))/2+a);
}
}