vector
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include <stdio.h> 2 #include <string.h> 3 #include <vector> 4 #include <algorithm> 5 using namespace std; 6 7 int main() 8 { 9 vector<int>edg[1005]; 10 int n; 11 int u,v; 12 int i,j,k; 13 scanf("%d",&n); 14 for(i=0;i<=n;i++) 15 { 16 if(edg[i].size()) 17 edg[i].clear(); 18 } 19 for(i = 0; i<n; i++) 20 { 21 scanf("%d %d",&u,&v); 22 edg[u].push_back(v); 23 edg[v].push_back(u); 24 } 25 26 u=5; 27 for(i=0;i<edg[u].size();i++) 28 { 29 v=edg[u][i]; 30 printf("%d",v); 31 } 32 return 0; 33 }