Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
1207 Kevin Jiang 13求1+2-3+4-5+……n的值 C++ Accepted 0 MS 264 KB 155 2023-08-22 11:53:57

Tests(10/10):


Code:

#include<iostream> using namespace std; int main(){ int a=0; cin>>a; if(a%2==0) cout<<3+(a-2)/2; else cout<<1-(a-1)/2; return 0; }