会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Loading
Doubest
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
下一页
2020年2月28日
1238. 日志统计
摘要: 题目链接: https://www.acwing.com/problem/content/1240/ 题解: 双指针算法,注意率先移动前向的指针,当前向指针的时间-后向指针的时间超过了规定时间的话,后项指针要移动到该区间里才行 AC代码: #include <cstdio> #include <cs
阅读全文
posted @ 2020-02-28 19:15 Doubest
阅读(189)
评论(0)
推荐(0)
2020年2月16日
1270. 数列区间最大值(climits用法+线段树模板题)
摘要: 题目链接: https://www.acwing.com/problem/content/1272/ 题解: 线段树模板题,单点求和、区间查询都可 AC代码: #include <cstdio> #include <iostream> #include <algorithm> #include <c
阅读全文
posted @ 2020-02-16 22:03 Doubest
阅读(143)
评论(0)
推荐(0)
1264. 动态求连续区间和(树状数组模板题)
摘要: 题目链接: https://www.acwing.com/problem/content/description/1266/ 题解: 模板题,记query()、add()、lowbit()函数即可 AC代码: #include <iostream> #include <cstdio> #includ
阅读全文
posted @ 2020-02-16 09:26 Doubest
阅读(183)
评论(0)
推荐(0)
2020年2月14日
788. 逆序对的数量(归并排序的应用)
摘要: 题目链接: https://www.acwing.com/problem/content/790/ 题解: 左边部分的下标必定小于右边部分的下标,且左右两边都排好序了,计算即可。 AC代码: #include <iostream> #include <cstring> #include <cstdi
阅读全文
posted @ 2020-02-14 14:27 Doubest
阅读(150)
评论(0)
推荐(0)
归并排序(模板题)
摘要: 题目链接: https://www.acwing.com/problem/content/description/789/ 题解: 1、找分界点。 2、分别排序 3、归并 递归实现 AC代码: #include <cstdio> #include <cstring> #include <iostre
阅读全文
posted @ 2020-02-14 13:34 Doubest
阅读(253)
评论(0)
推荐(0)
2020年2月13日
1231. 航班时间(字符串处理+sscanf用法)
摘要: 题目链接: https://www.acwing.com/problem/content/1233/ 题解: (飞行时间+时差 + 飞行时间 - 时差) / 2 = 飞行时间 AC代码: #include <cstdio> #include <cstring> #include <iostream>
阅读全文
posted @ 2020-02-13 22:43 Doubest
阅读(255)
评论(0)
推荐(0)
2020年2月12日
1229. 日期问题(超级字符串处理+unique用法)
摘要: 题目链接: https://www.acwing.com/problem/content/1231/ 题解: 估计自己太弱了,处理字符串比较痛苦,最后记得用unique去重。 代码: #include <cstring> #include <cstdio> #include <string> #in
阅读全文
posted @ 2020-02-12 15:54 Doubest
阅读(238)
评论(0)
推荐(0)
1219. 移动距离(水题,向上取整公式)
摘要: 题目链接: https://www.acwing.com/problem/content/1221/ 题解: 对于分子分母都是整数的除法,例如a/b,除了可以用ceil()函数向上取整外,还可以直接用公式(a+b-1)/b; 代码: #include <algorithm> #include <io
阅读全文
posted @ 2020-02-12 14:37 Doubest
阅读(196)
评论(0)
推荐(0)
2020年2月11日
1204. 错误票据(经典的输入处理方式)
摘要: 题目链接: https://www.acwing.com/problem/content/1206/ 题解: (1)getline()不会读\n,并且会抛弃读到的\n,而且不会留在缓冲区中。 (2)cin不会读\n,但是会把它留在缓冲区中等其他人读入 (3)stringstream在字符串、数字互转
阅读全文
posted @ 2020-02-11 22:16 Doubest
阅读(242)
评论(0)
推荐(0)
2020年2月10日
1214. 波动数列(负数取余公式)
摘要: 题目链接: https://www.acwing.com/problem/content/1216/ 题解: 一定要注意对于负数取余,要用数学上的定义,必须>=0 最后那个s也要记得用函数取余 AC代码: #include <iostream> #include <algorithm> #inclu
阅读全文
posted @ 2020-02-10 16:26 Doubest
阅读(295)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
下一页
公告