摘要:
类型: 有一个背包,容量为w,给你几种物品的体积和价值,问怎么放才能使背包总价值最高 数据:包包体积5 3件物品 价值 3 5 4 体积 2 4 1 上面的数字0-5代表背包容量为0-5时的情况 dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i]] + v[i]) 讲真 阅读全文
2018年4月3日 #
2018年4月2日 #
摘要:
裴蜀定理 在数论中,裴蜀等式(英语:Bézout’s identity)或贝祖定理(Bézout’s lemma)是一个关于最大公约数(或最大公约式)的定理。裴蜀定理得名于法国数学家艾蒂安·裴蜀,说明了对任何整数a、b和它们的最大公约数d,关于未知数x和y的线性丢番图方程(称为裴蜀等式): ax + 阅读全文
摘要:
给你个日期 问是星期几 知道1 1 1是周1就行了 #include <iostream>#include <cstdio>using namespace std;int arr[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};char str[7][10 阅读全文
2018年3月16日 #
摘要:
其实优化就在 i%su[j] == 0这上面 首先 任何数都是由若干个质因子构成的,假如 阅读全文
2017年11月22日 #
摘要:
B. Gluttony time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output B. Gluttony time limit per t 阅读全文
2017年11月19日 #
摘要:
A. Pride time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have an array a with length 阅读全文
2017年11月15日 #
摘要:
C. Short Program time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output C. Short Program time l 阅读全文
2017年11月12日 #
摘要:
C. Slava and tanks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output C. Slava and tanks ti 阅读全文
2017年11月10日 #
摘要:
这个算法 我个人认为是 遍历每一个点把它当成一些询问的最近祖先 1 2 3 4 5 6 low是并差集,vis是是否访问过,访问过为true,没有为false; 假设询问是(4,4),(4,5),(2,6),(3,6) 按程序最先递归到4点,之后4没有了后继节点, vis[4] = true; 证明 阅读全文
2017年11月5日 #
摘要:
E. Danil and a Part-time Job time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output E. Danil an 阅读全文