05 2019 档案
摘要:"坏掉的项链Broken Necklace" 难度:★ Code:
阅读全文
摘要:"黑色星期五" 难度:☆ Code: c++ include include include using namespace std; //Mystery_Sky // int day[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
阅读全文
摘要:"你的飞碟在这儿" 难度:☆ Code: c++ include include include using namespace std; int jisuan(char a[]); int main() { char a[7] = {}; char b[7] = {}; cin a; cin b;
阅读全文
摘要:"贪婪的送礼者Greedy Gift Givers" 难度:☆ Code: c++ include include include include using namespace std; //Mystery_Sky // struct People{ char name[20]; int out,
阅读全文
摘要:"机器人搬重物" ~~咕咕咕了几个星期,终于静下心来写完了这篇题解~~ 这道题的坑点还是比较多的,下面会一一列举。 先审题: 根据题目的意思,这是一道走迷宫的问题,显然用bfs去求解。 首先,我们需要建一张图。。。 这里很多人下意识地将题目中输入的图存下,这就涉及到了此题的第一个坑点了:
阅读全文
摘要:~~别问我为什么是指针~~ 单点修改+区间查询
阅读全文
摘要:"刺杀大使" 一道并不难的二分题,竟让我交了上20次,诶,果然还是我太弱了。 看完题目就基本想到要怎么做了: 只需要对最小伤害代价进行二分即可,check()函数里用搜索判断是否可以到达最后一行,这里的check()用深搜广搜都可以,两种的代码下面都会给出,而经过检验,这道题目用深搜会优于广搜。 如
阅读全文
摘要:"Best Cow Fences" 二分答案 + 前缀和 个人认为题意没有表述清楚,本题要求的是满足题意的连续子序列(~~难度大大降低了有木有~~)。 ~~本题的精度也是非常令人陶醉,请您自行体会吧!~~
阅读全文
摘要:"路标设置" 二分枚举”空旷指数“, 做法与跳石头类似。 cpp include include include using namespace std; //Mystery_Sky // define M 10000100 define INF 0x7f7f7f7f define ll long
阅读全文
摘要:"时间管理Time Management" 二分枚举开始时间。 cpp include include include using namespace std; //Mystery_Sky // define ll long long define M 10001000 define INF 0x7
阅读全文
摘要:"砍树" 二分答案,难度较低。 cpp include include include using namespace std; //Mystery_Sky // define M 10000100 define ll long long define INF 0x7f7f7f7f ll l, r,
阅读全文
摘要:"愤怒的牛" 二分答案模板题 cpp include include include using namespace std; //Mystery_Sky //二分查找(模板) define M 1000010 define ll long long define Mid (l+r+1)/2 int
阅读全文
摘要:"最长路" cpp include include include include include using namespace std; //Mystery_Sky // define maxn 1000010 define maxm 5000050 define INF 0x3f3f3f3f
阅读全文
摘要:"旅行计划" 待证明这样dp的正确性。 cpp include include include include using namespace std; //Mystery_Sky // define maxn 1000010 define maxm 5000050 define INF 0x3f3
阅读全文
摘要:```cpp include include include include using namespace std; //Mystery_Sky // define maxn 1000010 struct Edge{ int to, next; }edge[maxn]; int vis[maxn]
阅读全文
摘要:"混合背包" 混合背包模板题。
阅读全文
摘要:"数字组合" 01背包的变式。 做完这道题之后建议去做一做 "货币系统" 。
阅读全文
摘要:"买书" "货币系统" 的简化版,注意特判0。 cpp include include using namespace std; //Mystery_Sky // define ll long long define M 10000 int v, m; ll c[M], f[M]; int main
阅读全文
摘要:"P1474 货币系统 Money Systems" !! 不是noip2018的那道题。 简单的多重背包的变式。 cpp include include using namespace std; //Mystery_Sky // define ll long long define M 10000
阅读全文
摘要:"庆功会" 多重背包模板 比01背包多了一个将某种物品拆分的过程。
阅读全文
摘要:"公共子序列" 多组输入的 "最长公共子序列" 。 cpp include include include include using namespace std; //Mystery_Sky // define M 1000 string s1, s2; int f[M][M], len1, le
阅读全文
摘要:"方格取数" cpp include include using namespace std; //Mystery_Sky // define M 11 int f[M][M][M][M], a[M][M]; int n, x, y, z; int max1, max2; int main() {
阅读全文
摘要:"装箱问题" 01背包的变式,费用=价值。
阅读全文
摘要:"完全背包问题" 完全背包模板题 cpp include include using namespace std; //Mystery_Sky //完全背包模板 define M 1010 int f[M], c[M], w[M]; int v, m, ans; int main() { scanf
阅读全文
摘要:"01背包问题" 经典的01背包问题模板 这里提供两种做法:
阅读全文
摘要:"最长公共子序列" cpp include include include using namespace std; //Mystery_Sky // define M 1000 string s1, s2; int len1, len2; int f[M][M], ans; int main()
阅读全文
摘要:"最大子矩阵" 无脑操作题,由于n include using namespace std; //Mystery_Sky // define M 1000 int f[M][M], a[M][M]; int n, ans, maxn; int main() { scanf("%d", &n); fo
阅读全文
摘要:"最大上升子序列和" "最长上升子序列" 的变式。 状态转移方程: if(ai aj) fi = max(fi, fj+ai) cpp include include using namespace std; //Mystery_Sky // define M 1010 int maxn, n; i
阅读全文
摘要:"摘花生" 思路与 "最低通行费" 相似 cpp include include include include using namespace std; //Mystery_Sky // define M 1010 int a[M][M], f[M][M]; int t, n, m; int ma
阅读全文
摘要:"登山" 与 "合唱队形" 只差输出方式,难度较低。
阅读全文
摘要:"合唱队形" 对于每个点,找到以这个点为终点的最长上升序列长度以及以这个点为起点的最长下降序列长度,找到二者之和最大的点,然后用总人数减去该点二者之和即可。
阅读全文
摘要:"机器人搬重物" 坑点极多的一道bfs好题! cpp include include include include include using namespace std; //Mystery_Sky // define INF 0x3f3f3f3f const int M = 100; stru
阅读全文
摘要:题目链接 简单的floyd+剧毒的输入
阅读全文
摘要:"最低通行费" 由题意可得:第一行所有点只能一直左走走到,所以f[i][j] = a[i][j] + f[i][j 1], 同理第一列的点也只能一直向下走走到,f[i][j] = a[i][j] + f[i 1][j] 。 预处理完后,余下所有点到达该点的最小费用都等于min(到左边的点的最小费用,
阅读全文
摘要:"最长上升子序列" cpp include include using namespace std; //Mystery_Sky //最长上升子序列 define M 1010 int f[M], a[M], n; int ans; int main() { scanf("%d", &n); for
阅读全文
摘要:"拦截导弹(Noip1999)" 经典dp题目,这个做法并非最优解,详细参考洛谷 "导弹拦截" ,想想200分的做法。 cpp include include using namespace std; //Mystery_Sky //最长不上升序列+最长不下降序列 define M 1010 int
阅读全文
摘要:"三角形最佳路径问题" cpp include include using namespace std; //Mystery_Sky //还是 数字金字塔 define M 200 int f[M][M], a[M][M]; int ans, n; int main() { scanf("%d",
阅读全文
摘要:"求最长不下降序列" 状态转移方程:if(ai aj) fi = max(fi, fj+1)
阅读全文
摘要:"数字金字塔" 万年dp入门题 cpp include include include using namespace std; //Mystery_Sky // define M 1010 int f[M][M], a[M][M]; int n, ans; int main() { scanf("
阅读全文