이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |