Submission #211271

#TimeUsernameProblemLanguageResultExecution timeMemory
211271bashAsceticism (JOI18_asceticism)C++17
49 / 100
48 ms24952 KiB
#include<bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int n,m; int dp[3005][3005]; int add(int x, int y) { return ((x+y)%mod + mod)%mod; } int mul(int x, int y) { return ((1LL*x*y)%mod + mod)%mod; } int main() { scanf("%d%d",&n,&m); dp[1][1] = 1; for(int x=2;x<=n;x++) { for(int k=1;k<=m;k++) { dp[x][k] = add(mul(x-k+1, dp[x-1][k-1]), mul(k, dp[x-1][k])); } } printf("%d",dp[n][m]); }

Compilation message (stderr)

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