Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
54359 _ 治疗病人(cure) C++ 运行出错 0 0 MS 88 KB 950 2022-08-01 11:37:34

Tests(0/10):


#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; const int MXN = 405; const ull INF = 0x3f3f3f3f3f3f3f3fllu; ull dp[MXN][MXN][MXN]; ull N, M, K, A, B; int main() { // freopen("cure.in", "r", stdin); // freopen("cure.out", "w", stdout); scanf("%llu%llu%llu%llu%llu", &N, &M, &K, &A, &B); for (int i(0); i <= N; ++i) for (int j(0); j <= M; ++j) for (int k(0); k <= K; ++k) dp[i][j][k] = INF; for (int i(0); i <= N; ++i) dp[i][0][0] = 0; for (int i(1); i <= N; ++i) for (int j(1); j <= M; ++j) for (int k(0); k <= K; ++k) { for (int n(1); n <= j; ++n) { int c(k * 1.0 / n + 1); for (int x(0); x <= c; ++x) { dp[i][j][k] = min(dp[i][j][k], dp[i - 1][j - n][max(k - n * x, 0)] + n * A * x * x + B * n * n * x * x); } } } printf("%llu\n", dp[N][M][K]); return 0; }


测评信息: