随笔分类 - 完全背包
摘要:题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1398背包的硬币问题代码#include#includeint main(void){ int i,j,k,n; int dp[310]; int a[20]; for(i=1;i<...
阅读全文
摘要:题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1028dp 就是背包的硬币问题。可以类似 HDU 1284#include#includeint main(void){ int i,j,k,n; int dp[125]; memset(...
阅读全文
摘要:题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1114完全背包#include#include#includeusing namespace std;const int MAXN=999999999;int main(void){ int i,j,...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1284题目就是一个数学化简题,不是很难,一般会想到利用三个循环,直接暴力,这样答案是正确的,但很明显会超时,所以要想办法将其循环层数减少。i+2*j+3*k==n可以化为(n-3*k)/2;这样就减少了两...
阅读全文

浙公网安备 33010602011771号