05 2022 档案

摘要:#include <iostream> #include <algorithm> #include<cstdio> using namespace std; int a[1005][1005],b[1005][1005]; int main() { int n; scanf("%d",&n); fo 阅读全文
posted @ 2022-05-22 11:53 半喜 阅读(41) 评论(0) 推荐(0)
摘要:#include <iostream> #include <algorithm> #include<queue> using namespace std; int main() { int n,i,j; int t1,t2,w,temp; int sum; priority_queue<int,ve 阅读全文
posted @ 2022-05-21 23:28 半喜 阅读(20) 评论(0) 推荐(0)
摘要:#include <iostream> #include<queue> #include<cstdio> #include<cstring> using namespace std; struct node { char s[20]; int x; friend bool operator < (n 阅读全文
posted @ 2022-05-21 23:16 半喜 阅读(107) 评论(0) 推荐(0)
摘要:优先队列(priority queue) 普通的队列是一种先进先出的数据结构,元素在队列尾追加,而从队列头删除。 在优先队列中,元素被赋予优先级。当访问元素时,具有最高优先级的元素最先删除。 优先队列具有最高级先出的行为特征。通常采用堆数据结构来实现。 priority_queue常用方法 push 阅读全文
posted @ 2022-05-21 23:06 半喜 阅读(50) 评论(0) 推荐(0)
摘要:#include<iostream> #include<cstdio> #include<stack> #include<string> using namespace std; stack<int>p1; stack<char>p2; int n; string s; int main() { i 阅读全文
posted @ 2022-05-21 19:29 半喜 阅读(35) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<map> using namespace std; map<int,int>mymap; map<int,int>::iterator it; int main(){ int n,i,k,x; scanf("%d",&n); for(i=1;i<= 阅读全文
posted @ 2022-05-20 23:27 半喜 阅读(24) 评论(0) 推荐(0)
摘要:map是STL的一个关联容器,它提供一对一(其中第一个可以称为关键字,每个关键字只能 在map中出现一次,第二个可能称为该关键字的值)的数据 处理能力,由于这个特性,它 完成有可能在我们处理一对一数据的时候,在编程上提供快速通道。map内部自建一颗红黑 树(一 种非严格意义上的平衡二叉树),这颗树具 阅读全文
posted @ 2022-05-16 16:36 半喜 阅读(44) 评论(0) 推荐(0)
摘要:#include<iostream> #include<list> using namespace std; bool vis[100002]; //用来判断x同学是否还在队列中 list<int> li; //存储学生序号 list<int>::iterator pos[100002]; //迭代 阅读全文
posted @ 2022-05-16 16:31 半喜 阅读(36) 评论(0) 推荐(0)
摘要:List是一个双链表模板,可以从 任何地方快速插入与删除元素。 它的每个结点之间通过指针链接, 不能随机访问元素。 主要成员函数如下: empty():判断链表容器是否为空 size():返回链表容器中实际元素个数 push_back():在链表尾部插入元素 pop_back():删除链表容器的最后 阅读全文
posted @ 2022-05-15 21:07 半喜 阅读(31) 评论(0) 推荐(0)
摘要:#include<iostream> #include<cstdio> #include<set> using namespace std; int main() { multiset<int> s; multiset<int>::iterator it; int n,t,o; s.clear(); 阅读全文
posted @ 2022-05-15 15:42 半喜 阅读(46) 评论(0) 推荐(0)
摘要:#include<iostream> #include<set> using namespace std; int main() { set<int> s; set<int>::iterator it; int a[101],n,t; cin>>n;s.insert(n);n=n+1; while( 阅读全文
posted @ 2022-05-15 13:06 半喜 阅读(51) 评论(0) 推荐(0)
摘要:set关联式容器。set作为一个容器也是用来存储同一数据类型的数据类型,并且能从一个数据集合中取出数据,在set中每个元素的值都*唯一*,而且系统能根据元素的值*自动进行排序*。C++ STL中标准关联容器set, multiset, map, multimap内部采用的是一种非常高效的平衡检索二叉 阅读全文
posted @ 2022-05-14 14:26 半喜 阅读(26) 评论(0) 推荐(0)
摘要:vector是向量类型,可以容纳许多类型的数据,也被称为容器。可以理解成变长数组。 (1)头文件#include<vector>. (2)创建vector对象,vector<int> vec; (3)尾部插入数字:vec.push_back(a); (4)使用下标访问元素,cout<<vec[0]< 阅读全文
posted @ 2022-05-14 14:21 半喜 阅读(34) 评论(0) 推荐(0)