P1209 几何图形还原
2017-06-03 18:15
218 查看
P1209 几何图形还原
2017年6月3日
2017年6月3日
#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; int N; int a, b; bool edges[60][60]; int Recalls[60 * 60 + 10];//记录 int tails = 0;//Recalls bool Jus[60]; bool flag = false; void Putin() { cin >> N; memset(edges, false, sizeof(edges)); memset(Jus, false, sizeof(Jus)); while(cin >> a >> b){ edges[a][b] = true; edges[b][a] = true; } } inline bool Checke() { for(int i = 1; i <= N; i++) if(Jus[i] == false) return false; return true; } void Dfs(int s) { if(s == 1 && Checke() == true){ flag = true; return; } for(int i = 1; i <= N; i++) if(edges[i][s] == true && Jus[i] == false){ edges[i][s] = false; edges[s][i] = false; Jus[i] = true; Dfs(i); if(flag == true && i != 1){ Recalls[++tails] = i; return; } edges[i][s] = true; edges[s][i] = true; Jus[i] = false; } } int main() { Putin(); Dfs(1); cout << 1 << ' '; for(int i = tails; i >= 1; i--) cout << Recalls[i] << ' '; cout << endl; return 0; }
相关文章推荐
- Android之Graphics 简单绘制几何图形
- WPF之路——绘制几何图形
- OpenGL入门学习——第二课 绘制几何图形
- OpenGL_Qt学习笔记之_02(绘制简单平面几何图形)
- UIKit-UIView二维图形Affine几何变…
- 利用接口和多态性计算几何图形的面积和周长并显示
- WPF 图形对象和几何提对象
- 通过程序设计几何图形(Shape)、矩形(Rectangle)、圆形(Circle)、正方形(Square)几种类型, 能够利用接口和多态性计算几何图形的面积和周长并显示。
- 通过程序设计几何图形(Shape)、矩形(Rectangle)、圆形(Circle)、正方形(Square)几种类型, 能够利用接口和多态性计算几何图形的面积和周长并显示。
- 通过程序设计几何图形(Shape)、矩形(Rectangle)、圆形(Circle)、正方形(Square)几种类型, 能够利用接口和多态性计算几何图形的面积和周长并显示。
- 常见的图形图像相关的几何算法
- Win10系列:VC++绘制几何图形1
- SAT数学公式之几何图形
- js做拼图游戏存在随机生成的图形,有时不可还原的问题
- 如何在Word中插入几何画板图形
- 多线段几何图形—— 简单几何图形(求几何图形面积)
- GEOS库的学习之二:简单几何图形的创建
- ArcGIS Flex API扩展之几何图形
- WPF-画刷、绘图、几何绘图、图形的效果与滤镜、图形变换和动画
- OpenGL入门学习——第三课 绘制几何图形的一些细节问题