摘要:
超大背包问题,刚开始想复杂了。分段填充背包,前面一大部分用性价比最高的填充,最后一部分动规就可以了。 题目链接:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2408 Pick apples Time L 阅读全文
摘要:
这题用了冒泡排序的思想,不过紫书上的描述有误,建议参考原题。 #include using namespace std;deque a;vector res;bool is_order(){ for (int i = 1; i != a.size(); ++i) if (a[i] > n, n... 阅读全文
摘要:
Description Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point lo... 阅读全文
摘要:
Problem Description 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。 #include #include #include using ... 阅读全文