Lang:G++
Edit1234567891011121314151617181920212223#include <cstdio>#include <map>using namespace std;map<int, int> m;const int md = 19999997;long long f(const int x) {if(x <= 2) return x ? 1 : 0;if(m.count(x)) return m[x];const int k = x >> 1;const long long a = f(k);const long long b = f(k + 1);if(x & 1) return m[x] = (a * a + b * b) % md;else return m[x] = a * (b + b - a + md) % md;}int main() {int n;scanf("%d", &n);printf("%d\n", int(f(n + 1)));return 0;}