摘要: #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)
摘要: #include<cstdio> #include<algorithm> #include<cstring> #include<iostream> using namespace std; struct number{ int x,y; }stu[10010]; int cmp(number x1, 阅读全文
posted @ 2022-04-24 22:13 半喜 阅读(45) 评论(0) 推荐(0)
摘要: #include<cstdio> #include<algorithm> #include<cstring> #include<iostream> using namespace std; struct number{ int x,y; }stu[50020]; int cmp(number x1, 阅读全文
posted @ 2022-04-24 22:04 半喜 阅读(58) 评论(0) 推荐(0)
摘要: #include<cstdio> #include<algorithm> #include<cstring> #include<iostream> using namespace std; int main() { int i,x,a[1010]={0},b[1010]={0}; i=0; whil 阅读全文
posted @ 2022-04-24 16:32 半喜 阅读(22) 评论(0) 推荐(0)
摘要: #include<cstdio> #include<algorithm> using namespace std; struct time{ //下面要用到结构体,所以定义结构体要在最上面 int x,y; }stu[1010]; int cmp(time x1,time x2){//排序以结尾时间 阅读全文
posted @ 2022-04-22 18:33 半喜 阅读(155) 评论(0) 推荐(0)
摘要: #include<cstdio> #include<algorithm> #include<cstring> #include<iostream> using namespace std; int cmp(string s1,string s2){ return s1+s2>s2+s1; } int 阅读全文
posted @ 2022-04-22 16:51 半喜 阅读(24) 评论(0) 推荐(0)
摘要: #include<stdio.h> int main(){ int a[100]={0}; int n,m,l=0,i,j,s=0; scanf("%d %d",&n,&m); for(i=1;i<=n;i++){ for(j=1;j<=m;j++){ ++s; if(s>n) s=1;//s从头开 阅读全文
posted @ 2022-04-19 18:51 半喜 阅读(60) 评论(0) 推荐(0)
摘要: #include<iostream> #include<cstdio> #include<algorithm> #include<string> using namespace std; int main() { string s; int a[260]= {0},i,j,n; cin>>s; in 阅读全文
posted @ 2022-04-19 00:26 半喜 阅读(33) 评论(0) 推荐(0)