摘要: 2020.3 蓝桥杯模拟赛的一题 坑货,此题无法用dp,因为不管你怎么调整i和j的循环顺序,都会发现需要用到的状态没有被计算到。 能用记忆化搜索并不等价于能用dp,但是反之能用dp一定可以写成记忆化 记搜 #include<iostream> using namespace std; const i 阅读全文
posted @ 2020-10-16 20:48 yys_c 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 写吐了。。。 #include<iostream> using namespace std; #define LL long long LL S(LL n){ return (4 * n + 1) * (n + 1); } int main(){ LL x, y, res = 0; cin >> x 阅读全文
posted @ 2020-10-16 17:17 yys_c 阅读(73) 评论(0) 推荐(0) 编辑
摘要: 另外本题还要注意一下他要输出路径,所以开一个数组记录一下后继结点 #include<iostream> #include<cstdio> using namespace std; const int N = 30, INF = 0x3f3f3f3f; int f[N]; int w[N]; int 阅读全文
posted @ 2020-10-16 12:46 yys_c 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 归并排序 #include<iostream> using namespace std; const int N = 100010; int q[N], temp[N]; int n; void merge_sort(int l, int r){ if(l == r) return; int mid 阅读全文
posted @ 2020-10-16 11:20 yys_c 阅读(61) 评论(0) 推荐(0) 编辑
摘要: 闰年判断:y % 4 == 0 && y % 100 || y % 400 == 0 #include<iostream> using namespace std; int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 阅读全文
posted @ 2020-10-16 10:56 yys_c 阅读(80) 评论(0) 推荐(0) 编辑