摘要: lower_bound( )和upper_bound( )都是利用二分查找的方法在一个排好序的数组中进行查找的。 在从小到大的排序数组中, lower_bound( begin,end,num):从数组的begin位置到end-1位置二分查找第一个大于或等于num的数字,找到返回该数字的地址,不存在 阅读全文
posted @ 2019-11-28 21:25 Maynerd 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://vjudge.net/problem/127221/origin A string is called palindrome if it reads the same from left to right and from right to left. For exampl 阅读全文
posted @ 2019-11-28 21:19 Maynerd 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 首先,定义一个二维数组int Array[y][x]; 一、 对于二维数组的指针偏移的运算法则。同一维数组一样,二维数组的数组名也是指向第一个数组元素的(即Array等于&Array[0][0]),且二维数组的数组元素在计算机内的内存存放也是连续的,但不一样的是:Array+1的值不是&Array[ 阅读全文
posted @ 2019-11-24 21:37 Maynerd 阅读(1647) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://vjudge.net/problem/343761/origin 参照博客:https://blog.csdn.net/qq_39060776/article/details/81302809 网上参照的这种解题方法叫做三分,它提到:二分是在有序序列找某值,而三分是在类似二 阅读全文
posted @ 2019-11-21 23:47 Maynerd 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5015 通过这道例题就能大概入一个门吧。 参考知乎链接(快速幂/矩阵快速幂):https://www.zhihu.com/tardis/sogou/art/42639682 参考题目博客:https:// 阅读全文
posted @ 2019-11-21 18:40 Maynerd 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://ac.nowcoder.com/acm/contest/1168/C 来源:牛客网 题目描述 已知了飞行器的起点和终点以及n个休息站的坐标,问起点到终点的最短路径是多少? 限制:飞行器不能长期飞行,必须中途在某结点下停下休息。(即连续飞行距离应不大于m) 欧涛师兄很想在师妹 阅读全文
posted @ 2019-11-16 19:59 Maynerd 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/652/B B. z-sort time limit per test 1 second memory limit per test 256 megabytes input standard input ou 阅读全文
posted @ 2019-11-12 22:16 Maynerd 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 描述 Description 一辆重型卡车欲穿过S公里的沙漠,卡车耗汽油为1升/公里,卡车总载油能力为W公升。显然卡车装一次油是过不了沙漠的。因此司机必须设法在沿途建立若干个贮油点,使卡车能顺利穿过沙漠。试问司机如怎样建立这些贮油点?每一贮油点应存储多少汽油,才能使卡车以消耗最少汽油的代价通过沙漠? 阅读全文
posted @ 2019-11-11 23:38 Maynerd 阅读(719) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/652/A A. Gabriel and Caterpillar time limit per test 1 second memory limit per test 256 megabytes input 阅读全文
posted @ 2019-11-11 23:00 Maynerd 阅读(130) 评论(0) 推荐(0) 编辑
摘要: HDU 1711 Number Sequence(模板题) #include<stdio.h> #include<string> const int maxn=1e6+10; const int maxm=1e4+10; int t,n,m,s[maxn],p[maxn]; int next[max 阅读全文
posted @ 2019-11-09 14:39 Maynerd 阅读(521) 评论(0) 推荐(0) 编辑