Submission #19696

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