zoukankan      html  css  js  c++  java
  • CCF 送货 + 欧拉路模板

    #include <bits/stdc++.h>
    using namespace std;
    stack<int> st;
    vector<int> vec[10005];
    bool mp[10005][10005];
    int vis[10005],cp[10005];
    int n,m;
    
    void pd(int a)//先判断是不是联通图
    {
        cp[a]=1;
        vector<int>::iterator it; 
        for(it=vec[a].begin();it!=vec[a].end();it++)
        {       
            if(!cp[*it])
            {
                pd(*it);
            }   
        }
        
    }
    void DFS(int u)
    {
        for(int i = 0;i < vec[u].size();i++){
            int v = vec[u][i];
            if(mp[u][v])                              //当一个节点的所有路径都被走过的时,压入栈中
            {                                             //越是先压入栈中的数据,越是需要后访问
                mp[u][v]--;
                mp[v][u]--;
                DFS(v);
                
            }
        }
      st.push(u); }
    void put() { st.push(1); //因为DFS(int a)是压入起始点之后的节点,所以需要加入起始点 while(!st.empty()) { cout<<st.top()<<" "; st.pop(); } cout << endl; }
  • 相关阅读:
    shift
    start
    exit
    call
    goto
    Activity生命周期(二)
    color 和 mode
    pause 和 title
    day 4 飞机大战-面向对象
    day 3 创建窗口,移动-函数版
  • 原文地址:https://www.cnblogs.com/Norlan/p/5373604.html
Copyright © 2011-2022 走看看