摘要: 题目大意: 单词接龙,找出最长的长度的单词。 题解: 由于数据量较小,单词可多次使用,使用后可回溯,考虑dfs。 代码: #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e3 + 10 阅读全文
posted @ 2024-09-04 21:21 Ynyyy 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 前置: 二分查找, 最长单调不升子序列,最长单调不降子序列(dilworth)。 题解: 可以用来练习手写二分,二分优化的最长上升子序列时间复杂度O(nlogn)。但是坑是非常多的。 代码: #include <bits/stdc++.h> using namespace std; typedef 阅读全文
posted @ 2024-08-20 23:46 Ynyyy 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 解法: 从底往上dp,每次取下一行相邻两个数最大的即可。 代码: #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e3 + 10; int n; int f[N][N]; void s 阅读全文
posted @ 2024-08-20 23:07 Ynyyy 阅读(3) 评论(0) 推荐(0) 编辑
摘要: P3045 [USACO12FEB]Cow Coupons 堆 反悔贪心 阅读全文
posted @ 2024-06-25 23:11 Ynyyy 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1347:【例4-8】格子游戏 阅读全文
posted @ 2024-06-22 23:47 Ynyyy 阅读(2) 评论(0) 推荐(0) 编辑
摘要: P1219 [USACO1.5] 八皇后 Checker Challenge #include <bits/stdc++.h> using namespace std; typedef long long ll; int n, l[50], r[50], vis[50], a[50]; int an 阅读全文
posted @ 2024-06-14 22:31 Ynyyy 阅读(6) 评论(0) 推荐(0) 编辑