题解 | #牛牛学数列#
牛牛学数列
https://www.nowcoder.com/practice/0b97367cd2184c12a0e02f7c223aee11
#include <stdio.h> int main() { int n; scanf("%d",&n);//分奇偶,数学思想 if (0 == n%2) { printf("%d",-n/2); } else { printf("%d",n/2+1); } return 0; }
牛牛学数列
https://www.nowcoder.com/practice/0b97367cd2184c12a0e02f7c223aee11
#include <stdio.h> int main() { int n; scanf("%d",&n);//分奇偶,数学思想 if (0 == n%2) { printf("%d",-n/2); } else { printf("%d",n/2+1); } return 0; }
相关推荐