# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
420737 | 2021-06-08T13:38:39 Z | qwerasdfzxcl | Asceticism (JOI18_asceticism) | C++14 | 1 ms | 204 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; const int MOD = 1e9+7; ll pw(ll a, ll e){ if (!e) return 1; ll ret = pw(a, e/2); if (e&1) return ret*ret%MOD*a%MOD; return ret*ret%MOD; } int main(){ int n, k; scanf("%d %d", &n, &k); ll ans = 0, tmp = 1; for (int i=k;i;i--){ ans += pw(i, n)*tmp; tmp = (-tmp*(n+1-k+i)%MOD)*pw(k-i+1, MOD-2)%MOD; } printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |