![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
STL
AAAAAAAC——
.。。。。。。。。。。。。
展开
-
类内sort
离散化需要两个cmp,自选~ 1、重载小于号,万能,永远可以! 2、 普通cmp函数。不可以!!!!! bool cmp(struct_A a,struct_A b){}; sort(pos,pos+pos.size(),cmp);//类外很ok,类内不让用!! 3、cmp结构体,可以!!!! struct cmp{ bool operator()(POINT &a,POINT &b){ return a.num<b.num; ..原创 2021-02-03 18:07:19 · 184 阅读 · 0 评论 -
类or函数模板
类模板 泛化:数据类型尚未定义,以typename代替,使用时直接套用。 template < typename T1 , typename T2> class Test{ public://必须带 Test(T1 a,T2 b):x(a),y(b){} private: T1 x; T2 y; } int main() { Test <int ,int > t(1,2);//数据类型随意,<>与()内数据类型对应即可 } 特原创 2020-07-15 23:03:21 · 146 阅读 · 0 评论 -
HASH 模板和题目总结(包括unordered_map)
大佬博客:https://blog.csdn.net/sdz20172133/article/details/98859255 (纯属为了记录,以后用的时候找起来方便)原创 2019-09-07 19:13:58 · 117 阅读 · 0 评论 -
hdu 5437Alisha’s Party(STL)
题意: Princess Alisha invites her friends to come to her birthday party. Each of her friends will bring a gift of some valuevv, and all of them will come at a different time. Because the lobby is not ...原创 2019-03-04 16:35:49 · 185 阅读 · 0 评论 -
hdu1027——Ignatius and the Princess II(STL)
题意:1-n的全排列,求字典序第k小的。 思路:这个题还是比较有意思的,也不难,右边x个数的全排列就是x!个,由k的范围,只需要考虑右边8个大数的全排列情况,剩下的小数,先输出就可以,8个数,就可以非常暴力的搞了 然后依次用k/,k%就能知道当前位置应该选择第几小数,然后记得更新,就完了,,最后小心PE。。。 代码: #include<iostream> #include&l...原创 2019-03-04 16:29:42 · 154 阅读 · 0 评论 -
hdu 1716排列2(STL)
题意: Ray又对数字的列产生了兴趣: 现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数。 Input 每组数据占一行,代表四张卡片上的数字(0<=数字<=9),如果四张卡片都是0,则输入结束。 Output 对每组卡片按从小到大的顺序输出所有能由这四张卡片组成的4位数,千位数字相同的在同一行,同一行中每个四位数间用空格分隔。 每...原创 2019-03-04 16:13:10 · 315 阅读 · 0 评论 -
ZOJ 3963 Heap Partition (STL)
题意: A sequenceS= {s1,s2, ...,sn} is calledheapableif there exists a binary treeTwithnnodes such that every node is labelled with exactly one element from the sequenceS, and for every non-ro...原创 2019-03-04 16:10:56 · 148 阅读 · 0 评论 -
poj-1338 Ugly Numbers(类似筛素数)
题意: Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, ... shows the first 10 ugly numbers. By convention, 1 is included. Given the integ...原创 2019-03-06 14:14:00 · 110 阅读 · 0 评论 -
HDU 4389 Template Library Management (贪心+STL)
题意: As an experienced ACMer, you must have known the importance of "code template library". With the help of pre-printed code library, you can implement the complicated algorithms correctly and effic...原创 2019-03-06 12:45:05 · 186 阅读 · 0 评论 -
ACM-ICPC 2018 徐州赛区网络预赛
A、Hard to prepare 推公式+矩阵快速幂 但是推公式失败了,,推了很久,但是还是感觉能做。。。 赛后看他人题解,,推错了,m=2^k,假设从第1个排到第n-1个,第n个位置有(m-2)情况数有m*((m-1)^(n-2))*(m-2),其中当第1个位置和第n-1个位置数不同时,第n个确实时(m-2),但是若这两个位置相同,第n个位置是有(m-1)种,所以当两个相同时,少乘了1,...原创 2018-09-09 20:09:42 · 205 阅读 · 0 评论 -
书上的题目-反思
1、题目是英文,作为英语学渣,读起来确实有些困难~百度翻译有许多病句,影响了题意理解!到书上找原题着实有些困难...倒是有找到原题的,例如b题,但是,STL的知识学的很差劲,看答案也看也有些费劲~不看答案自己写的根本无法编译~ 2、知识学的不扎实,做题就犯糊涂,不爱做,一直拖拖拖,拖到最后,还是不会~而且到最后,想赶作业了,麻烦事又一桩接一桩~~雪上加霜,最后只通过了5个题!倒数第二!经过反思,原创 2017-03-23 20:55:36 · 319 阅读 · 0 评论 -
书上的题目N-14
1、题意:将两个实数倒置相加,输出其和的倒置; 2、思路:暴力做法~将两个数分别倒置再相加,再倒置,然后输出。 3、感想:用的以前的做法,实不知怎么运用新学的知识~做此题有些繁琐! 4、代码: #include using namespace std; int A(int c) { int m[100],l=0,x,s=0,v=1,z; z=c; while原创 2017-03-23 20:51:39 · 266 阅读 · 0 评论 -
树书上的题目M-13
1、题意:找出数组中成两倍关系的数的组数; 2、思路:将数组中输入值的作为位置,令此位置的值+1,在找数组中不为0的位置,若其2倍的位置亦不为0,则计数+1.(每次循环开始,将数组全部赋值为0); 3、感想:没用STL的知识~题目不难,以前的知识解起来也不麻烦; 4、代码: #include using namespace std; int main() { int m[1原创 2017-03-23 20:44:06 · 268 阅读 · 0 评论 -
书上的题目L-12
1、题意:将输入的字符串倒序输出 2、思路:用以前的知识解决不了~借鉴别人的,get输入字符串,再用reverse将其倒序,然后输出。 3:感想:STL还是挺有用的,写这种程序挺方便简洁的。 4:代码: #include using namespace std; int main() { string s; char ss[71]; int n=0; while(cin.getline(s原创 2017-03-23 20:36:43 · 437 阅读 · 0 评论 -
书上的题目k_11
1、题意:将墙理齐,即,求一串数的平均值,输出 大于平均值的数多于平均值的和; 2、思路:将输入的数组求和,求平均值,再选出大于平均值的数,累加他们与平均数的差; 3、感想:还是用的以前的方法做的~尝试用STL编译都不通过~输出的时候要注意空格!!注意输出要求! 4、代码: #include #include using namespace std; int main() { in原创 2017-03-23 20:33:42 · 351 阅读 · 0 评论 -
书中的题目 j_10
1、题意:输入字符串组数,将输入的字符串的每个字母增大1输出,z换成a,依次输出. 2、思路:将z单独考虑,其他的字符加1输出,没组输出前,加一行,输出组数.原创 2017-03-21 19:31:14 · 207 阅读 · 0 评论