ZOJ 2475 Benny's Compiler(DFS)
来源:互联网 发布:淘宝网京剧服装青衣 编辑:程序博客网 时间:2024/05/01 13:39
主要用的是dfs
注意如果 x 引用x 那么是可以的.
#include <iostream>#include <cstdio>#include <memory.h>using namespace std;const int maxn = 110;int n, e;bool g[maxn][maxn], vis[maxn];bool dfs(int u){vis[u] = 1;for (int i = 1; i <= n; ++i){if(g[u][i] && u != i){if(vis[i])return false;else{vis[i] = 1;if(!dfs(i)) return false;vis[i] = 0;}}}return true;}int main(){while (scanf("%d", &n) && n > 0){memset(vis, 0, sizeof(vis));memset(g, false, sizeof(g));for (int i = 0; i < n; ++i){int u, v;scanf("%d %d", &u, &v);g[u][v] = 1;}scanf("%d", &e);if(dfs(e)){printf("Yes\n");}else{printf("No\n");}}return 0;}
- ZOJ 2475 Benny's Compiler(DFS)
- zoj 2475 Benny's Compiler
- zoj 2475 Benny's Compiler
- ZOJ 2475 Benny's Compiler 深搜查找环路
- ZOJ 2475 Benny's Compiler 有向图判读点是否存在环内
- benny!!
- ZOJ 3631 Watashi's BG(DFS)
- zoj - 3631 - Watashi's BG(dfs)
- 【DFS+剪枝】-ZOJ-3631-Watashi's BG
- ZOJ-#3631 Watashi's BG(DFS+剪枝)
- ZOJ 3631 Watashi's BG DFS
- ZOJ 1100 Mondriaan's Dream【状态压缩】【DP】【DFS】
- The Gnu's compiler
- What's JIT compiler
- Matt's S-plus Compiler
- ZOJ 2292 Anti-bug before Chinese Valentine's Day(DFS+剪枝)
- 组队赛#1 解题总结 ZOJ 3803 YY's Minions (DFS搜索+模拟)
- zoj 1100&& poj2411 Mondriaan's Dream (dfs&&枚举&&状态压缩dp)好题
- 0001 计算机语言概述
- error LNK2005 已经在 obj 中定义 错误
- 前谷歌高管给初入职场新人的14条忠告
- 4.opencv之画图2
- 将goagent配置为系统服务
- ZOJ 2475 Benny's Compiler(DFS)
- [Hadoop] 完全分布式集群安装过程详解
- 详解c++内存分配方式
- 调试技巧之调用堆栈 - Call stack
- 修改 Chrome 调试器为黑底白字样式
- SQL 练习
- Jquery测试题
- 简洁安全的单例模式——Java
- poj1065-小小的贪心