# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19712 | jeapi | 괄호 (kriii4_R) | C++98 | 0 ms | 9528 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
using namespace std;
typedef long long ll;
ll D[1000001];
int main() {
ll N, K;
cin >> N >> K;
D[1] = K;
for (int i = 2; i <= N; i++) {
if (i % 2 == 0) {
D[i] = (D[i - 1] + (D[i - 1] * K))%1000000007;
}
else
{
D[i] = (D[i - 1] * K)% 1000000007;
}
}
cout << D[N] << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |