
【C++STL--------------------】
文章平均质量分 56
Here_jiaxinwei
这个作者很懒,什么都没留下…
展开
-
STL-unique函数
CF上的代码是开放的,常常就能看到本渣与大神们的差距比如去重。。。这是本鶸代码。。。。。。。[cpp] view plain copy#include #include #include using namespace std; const int N = 100000; int a[N+5];转载 2016-10-13 08:59:19 · 342 阅读 · 0 评论 -
【Set】 迭代
怎么从第二个元素开始迭代; set::iterator Ite=s.begin();//设置迭代器; cout<<*Ite; //输出第一个元素; Ite++; //迭代器重载++,--运算; for(;Ite!=s.end();Ite++原创 2016-12-12 21:09:47 · 877 阅读 · 0 评论 -
【C++】 用string类定义字符串数组
#include#include#include#include#include#includeusing namespace std;int main(){ string ans; for(int i=0; i<4; i++) { cin>>ans; cout<<ans<<endl; }}用字符数转载 2016-10-26 15:26:09 · 26185 阅读 · 2 评论 -
C++ 优先队列 priority_queue 的基本使用方法【定义优先级】
转自:#include #include using namespace std; priority_queue big; //大根堆 priority_queue,greater > small; //小根堆,最后的两个“>”之间要有空格,vector不用单另开头文件。 C++中优先队列(priority queue常用来代替堆,每次直接加入新数转载 2017-04-14 16:43:17 · 6039 阅读 · 0 评论 -
霍夫曼编码 zoj 2339 Hyperhuffman
HyperhuffmanTime Limit: 5 Seconds Memory Limit: 32768 KBYou might have heard about Huffman encoding - that is the coding system that minimizes the expected length of the text if the codes原创 2017-04-21 08:54:27 · 458 阅读 · 0 评论 -
生成全排列(STL、dfs)
dfs:#include#include#include#include#define N 1000005#includeusing namespace std;int a[N],v[N];int n;void print(){ for(int i=1; i<=n; i++) printf("%d ",a[i]); puts("");}原创 2017-04-16 09:47:05 · 658 阅读 · 0 评论 -
STL sort函数
C++sort()函数的用法近来看了c++标准库这本书,学到了很多,就把这其中的一点C++sort()函数的用法写下来和大家分享吧!(一)为什么要用c++标准库里的排序函数Sort()函数是c++一种排序方法之一,学会了这种方法也打消我学习c++以来使用的冒泡排序和选择排序所带来的执行效率不高的问题!因为它使用的排序方法是类似于快排的方法,时间复杂度为n*log2(n),执行效率较高!转载 2016-10-24 12:47:02 · 512 阅读 · 0 评论 -
codeforces777c
C. Alyona and Spreadsheettime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDuring the lesson small girl Alyona works with one famou原创 2017-03-21 11:59:13 · 253 阅读 · 0 评论 -
【STL】 map、set;
mapLet the Balloon RiseTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 113243 Accepted Submission(s): 44255Problem Descript原创 2016-12-22 17:20:23 · 420 阅读 · 0 评论 -
【map】UVa 156 反片语;
题目:输入一些单词,找出所有满足如下条件的单词:该单词不能通过字母重排,得到输入文本中的另外一个单词。在判断是否满足条件时,字母不分大小写,但在输入是应保留输入中的大小写,按字典序进行排序(所有大写字母在小写字母的前面)。样例输入:ladder came tape soom leader acme RIDE lone Dreis peat ScAlE orb eye Rides d转载 2016-12-10 19:48:14 · 111 阅读 · 0 评论 -
二分查找 C 、C++STL
C语言代码://查找一个数字w,若有序表中只有一个w;int bsearch(int *A,int x,int y,int v){ int m; while(x<y) { m=x+(y-x)/2; if(A[m]==v) return m; else if(A[m]>v) y=m; else x=m转载 2016-11-02 00:18:02 · 442 阅读 · 0 评论 -
【STL-deque】双向队列
//双向队列 deque//by MoreWindows http://blog.youkuaiyun.com/morewindows#include #include #include using namespace std;int main(){ deque ideq(20); //Create a deque ideq with 20 elements of default value转载 2017-07-31 14:13:47 · 289 阅读 · 0 评论