Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
113265 | 王璇公·传统美德 | 装箱问题 | C++ | 通过 | 100 | 0 MS | 408 KB | 360 | 2023-12-02 08:10:10 |
using namespace std; const int N = 20010; int f[N], v[N]; int n, m; int main(){ cin>>m; cin>>n; for(int i = 1; i <= n; i++) cin>>v[i]; for(int i = 1; i <= n; i++){ for(int j = m; j >= v[i]; j--){ f[j] = max(f[j], f[j-v[i]] + v[i]); } } cout<<m - f[m]<<endl; return 0; }
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0