摘要:
MSDN中的定义:template void sort(RanIt first, RanIt last); //--> 1)template void sort(RanIt first, RanIt last, Pred pr); //--> 2)头文件:#include using namespace std;1.默认的sort函数是按升序排。对应于1)sort(a,a+n); //两个参数分别为待排序数组的首地址和尾地址2.可以自己写一个cmp函数,按特定意图进行排序。对应于2)例如:int cmp( const int &a, const int &b ){ 阅读全文
摘要:
这个题和求最长递增序列的题类似,为了能输出一组可行的数据,我还用了一点儿链表的知识。DescriptionPeter decided to wish happy birthday to his friend from Australia and send him a card. To make his present more mysterious, he decided to make achain. Chain here is such a sequence of envelopesA = {a1, a2, ..., an}, where the width and the heig... 阅读全文