• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Eric.cpp
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理

随笔分类 -  拓扑排序

 
hdu-4324(拓扑排序&强连通)
摘要:结论题:竞赛图中有环,则必存在三元环。拓扑排序判环,没什么好说的了。附代码:View Code #include <iostream>#include <string.h>#include <stdio.h>using namespace std;#define E 2002char a[E][E];int map[E][E];int count[E];bool Topsort(int n,int edge[][E]){ int i,top=-1; for(i=0;i<n;i++) if(count[i]==0) { count[i... 阅读全文
posted @ 2012-08-01 18:38 Eric.cpp 阅读(291) 评论(0) 推荐(0)
拓扑排序
摘要:邻接矩阵:View Code #include <iostream>#include <stdio.h>using namespace std;#define E 1001void Topsort(int count[],int n,int edge[][E]){ int i,top=-1; for(i=0;i<n;i++) if(count[i]==0) { count[i]=top; top=i; } for(i=0;i<n;i++) if(top==-1) ... 阅读全文
posted @ 2012-05-25 15:40 Eric.cpp 阅读(363) 评论(0) 推荐(0)
 

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3