上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 54 下一页
  2023年3月3日
摘要: 坐标纸的 1~n 行,每一整数行有一条线段 [ x,y ] , 从( n,m ) 每次往下掉,碰到线段就向端点跑,然后继续掉 问到达(0,0) 最小的水平移动距离 f[i][0] = min(f[j][0] + abs(L[i] - L[j]), f[j][1] + abs(L[i] - R[j]) 阅读全文
posted @ 2023-03-03 15:17 towboat 阅读(61) 评论(0) 推荐(0)
  2023年3月2日
摘要: 只要某数字的十进制表示中有三个连续的 6 ,古代人也认为这是个魔鬼的数,比如 666,1666,6663,16666,6660666 古代典籍中经常用“第X小的魔鬼的数”来指代这些数, 输入XX ,输出对应的第X个魔鬼数 二分 X ,看1~X 有几个这样的数,以此检验 #include <iostr 阅读全文
posted @ 2023-03-02 22:00 towboat 阅读(60) 评论(0) 推荐(0)
摘要: 求树上每个点的 最远点的距离 Di 换根dp #include <iostream> #include <vector> #include <algorithm> #include <cstring> using namespace std ; const int N=1e5,M=N; int nx 阅读全文
posted @ 2023-03-02 01:29 towboat 阅读(23) 评论(0) 推荐(0)
摘要: 消除方块,同色可以消除,产生价值 (len)^2 求最后最大的价值 区间dp #include <iostream> #include<queue> #include <cstring> #define IOS std::ios::sync_with_stdio(0) using namespace 阅读全文
posted @ 2023-03-02 01:15 towboat 阅读(48) 评论(0) 推荐(0)
  2023年2月27日
摘要: 给一些区间,挑出最少的区间覆盖 【0,L】 贪心:从0往后,每次挑出R 点最大的 #include <iostream> #include <algorithm> #include <cstring> #include <cmath> using namespace std ; const int 阅读全文
posted @ 2023-02-27 18:26 towboat 阅读(61) 评论(0) 推荐(0)
摘要: 给定n种硬币,其中第 i种硬币的面值为 Ai,共有p iCi 个。 从中选出若干个硬币,把面值相加,若结果为sS ,则称“面值sS 能被拼成”。 求 1∼M 1~M之间能被拼成的面值有多少个。 #include <iostream> #include <cstring> using namespac 阅读全文
posted @ 2023-02-27 15:23 towboat 阅读(42) 评论(0) 推荐(0)
摘要: 除了源点之外,树中所有度数为1 的节点都是入海口,可以吸收无限多的水,我们称之为汇点。 也就是说,水系中的水从源点出发,沿着每条河道,最终流向各个汇点。 问最大流量 f[ x] = sum{ min( f[y] ,z) } 换根,考虑 g[x] 流向所有(包括x往上) 时的最大流量 g[y]=f[y 阅读全文
posted @ 2023-02-27 00:06 towboat 阅读(50) 评论(0) 推荐(0)
  2023年2月26日
摘要: 求两段不相交子序列,他们异或和的 和最大 #include<iostream> #include <algorithm> #include <cstring> using namespace std; const int N =4e5+4; int ch[N*32][2],ans; int tot= 阅读全文
posted @ 2023-02-26 20:56 towboat 阅读(71) 评论(0) 推荐(0)
摘要: 从序列A中选出两个进行异或运算,得到的结果最大是多少? 两个数二进制插入Trie 每次遍历时尽量走反 #include<iostream> #include <algorithm> #include <cstring> using namespace std; const int N =1e5+4; 阅读全文
posted @ 2023-02-26 20:37 towboat 阅读(37) 评论(0) 推荐(0)
摘要: 给一些串,问每个串的唯一前缀,若不存在输出本身 #include<iostream> #include <cstring> #include <algorithm> using namespace std ; const int N =1e5; int ch[N][30],tot,val[N]; v 阅读全文
posted @ 2023-02-26 19:55 towboat 阅读(28) 评论(0) 推荐(0)
上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 54 下一页