Submission #44942

#TimeUsernameProblemLanguageResultExecution timeMemory
44942SpaimaCarpatilorAsceticism (JOI18_asceticism)C++17
49 / 100
98 ms56188 KiB
#include<bits/stdc++.h> using namespace std; int N, K, dp[3009][3009]; const int mod = 1e9 + 7; int mul (int x, int y) {return 1LL * x * y % mod;} void adto (int &x, int y) {x += y; if (x >= mod) x -= mod;} int main () { scanf ("%d %d", &N, &K); dp[1][0] = 1; for (int i=1; i<N; i++) for (int j=0; j<i; j++) { adto (dp[i + 1][j], mul (j + 1, dp[i][j])); adto (dp[i + 1][j + 1], mul (i - j, dp[i][j])); } printf ("%d\n", dp[N][K - 1]); return 0; }

Compilation message (stderr)

asceticism.cpp: In function 'int main()':
asceticism.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf ("%d %d", &N, &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...