提交时间:2026-04-17 16:53:55
运行 ID: 316906
#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 cnt= 0; for (int i = 4; i <= n; i += 2) { cnt = (4LL * b - a) % s; if (cnt < 0) cnt += s; a = b; b = cnt; } cout << cnt << endl; return 0; }