Submission #19777

# Submission time Handle Problem Language Result Execution time Memory
19777 2016-02-25T05:31:11 Z noeffserv 괄호 (kriii4_R) C++
0 / 100
3 ms 9532 KB
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <functional>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <iostream>

#define ENP     printf("**Entry Point**\n")
#define A       first
#define B       second
#define MP      make_pair

using namespace std;

typedef long long                       ll;
typedef vector  <double>              vec_d;
typedef vector  <vec_d>                   vvec_d;
typedef vector  <int>                 vec_i;
typedef vector  <vec_i>                   vvec_i;
typedef pair    <int, int>                pair_i;
typedef pair    < pair_i, pair_i >        pp_i;

const int INF = 0x60000000;
const int MINF = -1000000000;
const ll mod = 1000000007;
const int cons = 50000001;

ll dp[1000001];

int main()
{

	int n, k;
	scanf("%d%d", &n, &k);

	dp[0] = 1;
	dp[1] = (ll)k;

	for (int i = 2; i <= n; i++)
	{
		dp[i] = (dp[i - 1] * (ll)k + dp[i - 2] * (ll)k) % mod;
	}

	printf("%lld\n", dp[n]);

	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 9532 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -