2021.11.6 本题的数据非常大,不能够用常规的动态规划、递归进行解题,必定超时。 我一开始试了试python 百万级别数字,结果是-1,1 我有试了 输入样例 对应结果 1 -1 2 1 3 -1 4 1 看出来了吧 结果对应输入 奇数 结果为-1 偶数 结果为1 这样就可以写代码了!

#include<stack>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
ll k;
const int N = 1e9+7;
int main(){
    cin >> k;
    if(k%2) cout << -1;
    else cout << 1;
    return 0;
}