| 15919 | 2025-03-20 19:33:39 | 42 | Toronyépítés (80 pont) | cpp17 | Forditási hiba |
#include <unordered_map>
using namespace std;
const int mod = 20210108;
unordered_map<int, int> d = {{0, 1}, {1, 3}, {2, 10}, {3, 33}, {4, 109}, {5, 360}};
int f(int n) {
if (d.find(n) != d.end()) {
return d[n];
}
if (n % 2 == 0) {
int cur = (1LL * f(n / 2) * f(n / 2) + 1LL * f(n / 2 - 1) * f(n / 2 - 1)) % mod;
d[n] = cur;
return cur;
}
int cur = (1LL * f(n / 2) * (f(n / 2 - 1) + f(n / 2 + 1))) % mod;
d[n] = cur;
return cur;
}
int main() {
int N;
cin >> N;
cout << f(N) << "\n";
return 0;
}
open /var/local/lib/isolate/403/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:23:5: error: 'cin' was not declared in this scope
23 | cin >> N;
| ^~~
main.cpp:2:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
1 | #include <unordered_map>
+++ |+#include <iostream>
2 | using namespace std;
main.cpp:24:5: error: 'cout' was not declared in this scope
24 | cout << f(N) << "\n";
| ^~~~
main.cpp:24:5: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?