题目链接:www.codeforces.com/problemset/problem/486/A
题意:求表达式f(n)的值。(f(n)的表述见题目)
C++代码:
#include <iostream> using namespace std; long long f(long long n) { if (n % 2 == 0) return n / 2; else return n / 2 - n; } int main() { long long n; cin >> n; cout << f(n) << endl; return 0; }
C++
时间: 2024-10-10 10:55:47