-
个人简介
#include<bits/stdc++.h> using namespace std; int main(){ return 0; }邻接表
#include<iostream> #include<cstdio> #include<queue> #include<stack> #include<cstring> #include<string> #include<map> #include<algorithm> #include<cmath> using namespace std; struct edge{ int to,p,next; }e[1000005]; int vex[1000005]; int main(){ int n,m; cin>>n>>m; for(int i=1;i<=m;i++){ int a,b,c; cin>>a>>b>>c; //起点 终点 权值 e[i].to=b; e[i].p=c; e[i].next=vex[a];//帮助起点 记录一条边 vex[a]=i; } for(int i=1;i<=n;i++){ cout<<i<<":"; int now=vex[i]; while(now!=0){ printf("(%d,%d)->",e[now].to,e[now].p); now=e[now].next; } cout<<"\n"; } }
https://ac.xiaosaima.com/file/5052/.avatar.jpg

···''' /############\ /###//aaaaaaaa\\###\ /##<?phpxxooooxxphp?>##\ /#/xxxxoooo.........xxx\#\ /#/xxoo..................\#\ #/xxo..............###....\# /#xo.............######.....#\ #/o......#########..........\# #o..#######..##..............# /#o...........##....###.......#\ #/...###################......\# #....###################.......# #....##.......##......##.......# #....##.......##......##.......# #....##.......##......##.......# #....##.......##......##.......# #....##.......##..#...##.......# #....###......##...#..##.......# #...####......##...##.##......x# #....##.......##....####......x# #.............##.....##......xx# #\............##.............x/# \#............##............xx#/ #............##...........xxx# #\...........##..........xxx/# \#...........##..........xx#/ #\..........#..........xxx/# \#\.........#........xxxx/#/ \#\...............xxxxx/#/ \##\...........xxxxx/##/ \###\\....xxxx//###/ \############/
http://www.heyzxz.me/pcol/#include<bits/stdc++.h> using namespace std; int main(){ //创建一个栈 stack<int> s; //入栈 s.push(888); //获取栈顶元素 cout<<s.top()<<endl; s.push(666); cout<<s.top()<<endl; s.pop(); cout<<s.top()<<endl; cout<<s.size()<<endl; if(s.empty()==1){ cout<<"栈为空"<<endl; }else{ cout<<"栈不为空"<<endl; } return 0; } https://www.deepseek.com/
#include<bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; queue<string> q; for (int i=0;i<n;i++) { string x; cin >> x; q.push(x); } for (int i=0;i<m;i++) { string front=q.front(); q.pop(); q.push(front); } if (!q.empty()) { cout<<q.front(); q.pop(); while(!q.empty()) { cout<<" "<<q.front(); q.pop(); } } return 0;}
基本操作: 1、入栈 push 2、出栈 pop 3、取栈顶元素 top 4、判空 empty 5、获取大小 size
队列(queue)的特点:先进先出 基本操作: 1、入栈 push 2、出栈 pop 3、取队首 front 4、取队尾 back 5、判空 empty 6、获取大小 size
deepseek.com

-
最近活动