Submission #6345700
Source Code Expand
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<iomanip> using namespace std; typedef long long ll; const ll MOD = 1e9 + 7; int K; ll N; vector<ll> memo; ll dp( ll a){ if( a < 0){ return 0;} if( memo[a] != -1){ return memo[a];} ll res = 0; for(ll i = 1; i <= K; i++){ res += dp(a-i); res %= MOD;} return memo[a] = res;} int main(){ cin >> K >> N; memo = vector<ll> (N+10,-1); for(ll i = 0; i < K; i++){ memo[i] = 1;} cout << dp(N-1) << endl; return 0;}
Submission Info
Submission Time | |
---|---|
Task | T - フィボナッチ |
User | youyin |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 556 Byte |
Status | RE |
Exec Time | 492 ms |
Memory | 1226880 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 8 | ||||
Status |
|
Set Name | Test Cases |
---|---|
All | 00, 01, 02, 03, 04, 90, 91 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00 | RE | 96 ms | 256 KB |
01 | RE | 492 ms | 1226880 KB |
02 | RE | 97 ms | 256 KB |
03 | RE | 97 ms | 256 KB |
04 | RE | 97 ms | 256 KB |
90 | AC | 1 ms | 256 KB |
91 | AC | 2 ms | 384 KB |