Fork me on GitHub
摘要: nth_element函数原型有四个,详细我就不一一累赘了,我们就用最普通的用法寻找第k位置的元素。 函数用法为:nth_element(first,kth,end)。 first,last 第一个和最后一个迭代器,也可以直接用数组的位置。 kth,要定位的第k个元素,能对它进行随机访问. 将第k_ 阅读全文
posted @ 2018-08-05 11:20 Xenny 阅读(8634) 评论(1) 推荐(4) 编辑
摘要: 一、unique函数 这个函数的功能就是删除相邻的重复元素,然后重新排列输入范围内的元素,并返回一个最后一个无重复值的迭代器(并不改变容器长度)。 例如: 运行结果为 unique返回的是迭代器,但我们减去容器首位置就可以得到无重复的长度了。还有就是使用unique函数前得排序(或者保证容器是有序的 阅读全文
posted @ 2018-08-04 11:02 Xenny 阅读(578) 评论(0) 推荐(0) 编辑
摘要: 首先声明,本博文部分内容仅仅适用于ACM竞赛,并不适用于NOIP与OI竞赛,违规使用可能会遭竞赛处理,请慎重使用!遭遇任何情况都与本人无关哈=7= 我也不想搞得那么严肃的,但真的有些函数在NOIP与OI竞赛中有相关规定不能使用,详细我也不知道各位要了解请自行去找比赛要求咯,当然在ACM竞赛中,没有限 阅读全文
posted @ 2018-08-03 12:30 Xenny 阅读(11669) 评论(4) 推荐(36) 编辑
摘要: 都知道排序很重要,也学了各式各样的排序算法,冒泡、插入、归并等等,但其实在ACM比赛中,只要不是太慢的算法,都可以适用(除非某些题目卡时间卡的很死),这个时候,速度与技巧便成了关键,而在C++的标准库中,就已经定义好了一些排序函数,下面来一一介绍它们吧=7= Qsort 函数原型为void qsor 阅读全文
posted @ 2018-08-02 11:38 Xenny 阅读(1874) 评论(0) 推荐(3) 编辑
摘要: Problem Description The 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 1 阅读全文
posted @ 2018-08-01 23:31 Xenny 阅读(470) 评论(0) 推荐(0) 编辑
摘要: Problem Description Suppose that you are an admiral of a famous naval troop. Our naval forces have got 21 battleships. There are 6 types of battleship 阅读全文
posted @ 2018-08-01 12:14 Xenny 阅读(406) 评论(0) 推荐(0) 编辑
摘要: Problem Description The students of the HEU are maneuvering for their military training. The red army and the blue army are at war today. The blue arm 阅读全文
posted @ 2018-07-31 20:29 Xenny 阅读(373) 评论(0) 推荐(0) 编辑
摘要: Problem Description George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return s 阅读全文
posted @ 2018-07-31 19:23 Xenny 阅读(659) 评论(0) 推荐(0) 编辑
摘要: Problem Description The twenty-first century is a biology-technology developing century. We know that a gene is made of DNA. The nucleotide bases from 阅读全文
posted @ 2018-07-30 00:34 Xenny 阅读(1067) 评论(0) 推荐(0) 编辑
摘要: Problem Description Last night, little erriyue had a horrible nightmare. He dreamed that he and his girl friend were trapped in a big maze separately. 阅读全文
posted @ 2018-07-30 00:07 Xenny 阅读(883) 评论(0) 推荐(0) 编辑