#include <string>
#include <cmath>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <list>
#include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
vector<long long> a;
int n;
int k;
cin >> n >> k;
a.push_back(1);
a.push_back(k);
long long num;
for (int i = 2; i <= n; i++)
{
num = (a[i - 1] + a[i - 2])*k;
num %= 1000000007;
a.push_back(num);
}
cout << a[n] << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
7868 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |