Submission #528796

#TimeUsernameProblemLanguageResultExecution timeMemory
528796LucaDantasAsceticism (JOI18_asceticism)C++17
49 / 100
44 ms24912 KiB
#include <bits/stdc++.h> using namespace std; constexpr int maxn = 3e3 + 10, mod = 1000000007; int dp[maxn][maxn]; int main() { int n, k; scanf("%d %d", &n, &k); dp[1][0] = 1; --k; // já gasto um dia naturalmente que não conta for(int i = 1; i <= n; i++) { for(int down = 0; down <= k; down++) { // printf("(%d %d -> %d) ", i, down, dp[i][down]); dp[i+1][down+1] += 1ll * (i - down) * dp[i][down] % mod; if(dp[i+1][down+1] >= mod) dp[i+1][down+1] -= mod; dp[i+1][down] += 1ll * (down + 1) * dp[i][down] % mod; if(dp[i+1][down] >= mod) dp[i+1][down] -= mod; } // puts(""); } printf("%d\n", dp[n][k]); }

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...