Submission #19723

#TimeUsernameProblemLanguageResultExecution timeMemory
19723joojis괄호 (kriii4_R)C++14
0 / 100
4 ms3944 KiB
#include <cstdio> #include <vector> #define MOD (1000000007) main () { int N, K; scanf("%d %d", &N, &K); std::vector<long long unsigned> A(N+1, 0); A[0] = 1; A[1] = K; for (unsigned i=2; i<=N; i++) { A[i] = (A[i-1]*K + A[i-2]*K) % MOD; } printf("%llu ", A[N]); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...