Submission #20121

#TimeUsernameProblemLanguageResultExecution timeMemory
20121sys7961괄호 (kriii4_R)C++14
0 / 100
3 ms1860 KiB
#include<stdio.h> long long dy[100100]; long long m = 1000000007; int main() { long long n, k; scanf("%lld%lld", &n, &k); dy[0] = 1; long long sum = 0; long long p = 0; for (int i = 0; i < n; i++) { dy[i + 1] = (dy[i] * k)%m; p += sum; p %= m; dy[i + 1] += p; dy[i + 1] % m; sum += dy[i + 1]; sum %= m; } printf("%lld", dy[n]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...