Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
142370 梁乃元 采药 C++ 运行出错 0 0 MS 88 KB 554 2024-04-07 13:53:39

Tests(0/12):


# include <bits/stdc++.h> using namespace std ; long long tme [10005] , vle [10005] , dp [10005] [10005] ; int main ( ) { int t , m ; cin >> t >> m ; for ( int i = 1 ; i <= m ; i ++ ) { cin >> tme [i] >> vle [i] ; } for ( int i = 1 ; i <= m ; i ++ ) { for ( int j = 1 ; j <= t ; j ++ ) { dp [i] [j] = dp [i - 1] [j] ; if ( ( j >= tme [i] ) && ( dp [i] [j] < dp [i - 1] [j - tme [i]] + vle [i] ) ) { dp [i] [j] = dp [i - 1] [j - tme [i]] + vle [i] ; } } } cout << dp [m] [t] << endl ; return 0 ; }


测评信息: