Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
53009 wzj33300 数学,很美妙吧 C++ 解答错误 0 1000 MS 245864 KB 847 2022-07-20 13:22:10

Tests(0/10):


#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; int n, m, k; int f[405][405][405]; // n, k, s int fw[5005]; int fpow(int x, int y) { int ans = 1; while (y) { if (y & 1) { ans = 1ll * ans * x % mod; } x = 1ll * x * x % mod; y >>= 1; } return ans; } int main() { //freopen("math.in", "r", stdin); //freopen("math.out", "w", stdout); scanf("%d%d%d", &n, &k, &m); for (int i = 1; i <= n; i++) { fw[i] = fpow(i, m); } for (int i = 1; i <= k; i++) { for (int l = 1; l <= n; l++) { int sum = 0; for (int j = l; j <= n; j++) { sum = (1ll * sum + f[i - 1][j][l] + fw[j]) % mod; f[i][j][l] = sum; // printf("%d ", f[i][j]); } } } int sum = 0; for (int i = 1; i <= n; i++) { (sum += f[k][n][i]) %= mod; } printf("%d\n", sum); return 0; }


测评信息: