제출 #20013

#제출 시각아이디문제언어결과실행 시간메모리
20013suzy괄호 (kriii4_R)C++98
0 / 100
6 ms14328 KiB
#include <cstdio> #include <cstring> using namespace std; const int MOD = 1000000007; int dp[1000000], N, K; int paren(int pos){ if(pos == N) return 1; int &ret = dp[pos]; if(ret != -1) return ret; ret = paren(pos+1); if(pos < N-1) ret += paren(pos+2); return ret = 1LL*K*ret % MOD; } int main(){ scanf("%d %d", &N, &K); memset(dp, -1, sizeof(dp)); printf("%d\n", paren(0)); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...