Submission #155349
Source Code Expand
#include <iostream> #include <algorithm> #include <vector> #define max(x, y) (((x) > (y))? (x) : (y)) #define abs(x) (((x) < 0)? (-1*(x)) : (x)) int dp[1000000]; using namespace std; int tori(int n) { if (n == 0) return 0; else if (n == 1) return 0; else if (n == 2) return 1; if (dp[n] >= 0) return dp[n]; dp[n] = tori(n - 1) + tori(n - 2) + tori(n - 3); return dp[n]; } int main() { int n; memset(dp, -1, sizeof(dp)); cin >> n; cout << (tori(n - 1) % 10007) << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - トリボナッチ数列 |
User | ericode |
Language | C++ (G++ 4.6.4) |
Score | 0 |
Code Size | 541 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:27:27: error: ‘memset’ was not declared in this scope