Submission #364206

#TimeUsernameProblemLanguageResultExecution timeMemory
364206fhvirusAsceticism (JOI18_asceticism)C++17
49 / 100
8 ms8300 KiB
#include<cstdio> #include<cassert> #define ll long long const int N = 3003, M = 1'000'000'007; ll dp[N][N]; int main(){ int n, k; scanf("%d%d", &n, &k); assert(n <= 3000); dp[0][0] = 1; for(int i = 1; i <= n; ++i){ for(int j = 1; j <= i and j <= k; ++j){ dp[i][j] += dp[i-1][j] * j; dp[i][j] += dp[i-1][j-1] * (i - (j - 1)); dp[i][j] %= M; } } // for(int i = 0; i <= n; ++i){ // for(int j = 0; j < k; ++j){ // printf("%lld ", dp[i][j]); // } // puts(""); // } printf("%lld", dp[n][k]); return 0; }

Compilation message (stderr)

asceticism.cpp: In function 'int main()':
asceticism.cpp:9:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |  int n, k; 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...