#include <iostream> #include <cmath> #include <cstring> using namespace std; int a[3] = {150, 200, 350}; int f[10001]; int main() { //freopen("1.txt", "r", stdin); int t; cin >> t; while(t--) { int n; cin >> n; memset(f, 0, sizeof(f)); for(int i = 0; i < 3; i++) { for(int j = a[i]; j <= n; j++) { if(f[j - a[i]] + a[i] <= n && f[j - a[i]] + a[i] > f[j]) f[j] = f[j - a[i]] + a[i]; } } cout << n - f[n] << endl; } return 0; }
hdu 1248 寒冰王座 完全背包
最新推荐文章于 2021-04-14 20:18:56 发布
5万+

被折叠的 条评论
为什么被折叠?



