提交时间:2026-04-17 16:48:32

运行 ID: 316902

#include<bits/stdc++.h> using namespace std; const int s = 1000000007; int main() { int n; cin >> n; if (n % 2 != 0) { cout << 0 << endl; return 0; } if (n == 0) { cout << 1 << endl; return 0; } int a = 1; int b = 3; if (n == 2) { cout << b << endl; return 0; } int cut = 0; for (int i = 4; i <= n; i += 2) { cut = (4LL * b - a) % s; if (cut < 0) cut += s; a = b; b = cut; } cout << cut << endl; return 0; }