Codeforces Round #291 (Div. 2) 题解
来源:互联网 发布:linux kill -9用法 编辑:程序博客网 时间:2024/04/25 08:21
【A】一个trick,首位为9不能改,其他满足改了之后比之前大的都改就可以了。
【B】暴力,标记一下即可!
【C】题意:有n个字符串,对于之后的字符串,询问在这n个中是否有长度相同且恰有一个字符不同的字符串。解题方法:字典树,暴力!代码见这里:http://paste.ubuntu.com/23445724/
【D】题意:给定n m k下面是n*m的矩阵,最多可以操作k次,每次操作可以使任意一列上所有的数 -= 1,( 0还是0),要求得到连续最多的行数(每行里的整数都为0),输出任意一个方案(在每一列上操作的次数)。解题方法:把每列单独考虑。枚举每行,二分找这行往下最多能清空的行数,RMQ维护一列的最大值。代码见这里:http://paste.ubuntu.com/23445729/
【E】题意:给出一颗树,父节点到子节点有不同的路径,求解离根节点的距离不大于x的节点数(含根结点)。解题方法:设距离是i的结点个数是dp[i],父节点到子节点距离是i的路径的条数是cnt[i]。对于样例里面的矩阵就是这样:
然后轻易的推广一下这个矩阵,大家可以看下这篇blog:http://blog.csdn.net/thearcticocean/article/details/50908698
然后把,矩阵幂套上去就可以a了。
代码见这里:http://paste.ubuntu.com/23445725/
0 0
- 【codeforces】Codeforces Round #291 (Div. 2) 题解
- Codeforces Round #291 (Div. 2) 题解
- 【codeforces】Codeforces Round #276 (Div. 2) 题解
- 【codeforces】Codeforces Round #277 (Div. 2) 题解
- 【codeforces】Codeforces Round #279 (Div. 2) 题解
- 【codeforces】Codeforces Round #283 (Div. 2) 【题解】
- Codeforces Round #131 (Div. 2) 完整题解
- Codeforces Round #135 (Div. 2)题解
- Codeforces Round #192 (Div. 2) 题解报告
- Codeforces Round #194 (Div. 2) 题解
- Codeforces Round #216 (Div. 2)部分题解
- Codeforces Round #226 (Div. 2) 题解
- Codeforces Round #177 (Div. 2) 题解
- Codeforces Round #FF (Div. 2) 题解
- Codeforces Round #256 (Div. 2) 题解
- Codeforces Round #257 (Div. 2) 题解
- Codeforces Round #259 (Div. 2) 题解
- Codeforces Round #260 (Div. 2) 题解
- 问题:flush()与ob_flush()函数????
- 一触即发 App启动优化最佳实践
- 数据挖掘面试--火烈鸟网络
- ssh的增删该查
- 11.08队内胡策
- Codeforces Round #291 (Div. 2) 题解
- 杭电 1230 火星a+b 【大数】【进制转换】
- WebRTC学习资料大全
- Python各种参数
- Android使用Camera2 替代过时的Camera API
- /etc/ld.so.conf文件介绍
- webkit+各种js交互方法
- 微信小程序开发之选择器 时间选择器 日期选择器 地区选择器
- Android多分辨率适配框架使用指南