# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
20013 | | suzy | 괄호 (kriii4_R) | C++98 | | 6 ms | 14328 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |