Submission #19863

# Submission time Handle Problem Language Result Execution time Memory
19863 2016-02-25T06:22:14 Z joojis 괄호 (kriii4_R) C++14
0 / 100
4 ms 4084 KB
#include <iostream>
#include <vector>

using namespace std;

const long long unsigned MOD = 1000000007;

void solveCase ()
{
  long long unsigned N, K;
  cin >> N >> K;
  vector<long long unsigned> A(N+1);
  A[0] = 1;
  A[1] = K;
  for (unsigned i=2; i<=N; i++) {
    A[i] = (A[i-1]*K + A[i-2]*K) % MOD;
  }
  cout << A[N] << endl;
}

int main ()
{
#ifdef _TC
  int T = _TC;
#else
  int T = 1;
#endif
  while (T--) {
    solveCase();
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 4084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -