Submission #48228

#TimeUsernameProblemLanguageResultExecution timeMemory
48228lovemathboyAsceticism (JOI18_asceticism)C++14
49 / 100
1104 ms262144 KiB
#include <bits/stdc++.h> using namespace std; vector<vector<long long> > memo; long long mod = 1000000007; int n, k; int main() { scanf("%d %d", &n, &k); k--; memo.resize(n+1); for (int i = 0; i <= n; i++) { memo[i].resize(k+1); } for (int i = 1; i <= n; i++) { if (i <= k) memo[1][i] = 0; memo[i][0] = 1; } for (int i = 1; i <= n; i++) { for (int j = 1; j <= k; j++) { memo[i][j] = (memo[i-1][j] * (j + 1) + memo[i-1][j-1] * (i - j)) % mod; } } printf("%lld\n", memo[n][k]); return 0; }

Compilation message (stderr)

asceticism.cpp: In function 'int main()':
asceticism.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &k); k--;
     ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...