UVa 291 - The House Of Santa Claus
来源:互联网 发布:机械制图用什么软件 编辑:程序博客网 时间:2024/04/26 17:16
题目:欧拉回路。
分析:简单题、搜索。
#include <stdio.h>#include <stdlib.h>#include <string.h>int G[6][6] = {0};int save[9];void dfs( int s, int n, int d, int e ){if ( d == e ) {for ( int i = 0 ; i < e ; ++ i )printf("%d",save[i]);printf("%d\n",s);return;}save[d] = s;for ( int i = 1 ; i <= n ; ++ i )if ( G[s][i] ) {G[s][i] = 0;G[i][s] = 0;dfs( i, n, d+1, e );G[s][i] = 1;G[i][s] = 1;}}int main(){G[1][2] = G[2][1] = 1;G[1][3] = G[3][1] = 1;G[1][5] = G[5][1] = 1;G[2][3] = G[3][2] = 1;G[2][5] = G[5][2] = 1;G[3][4] = G[4][3] = 1;G[3][5] = G[5][3] = 1;G[4][5] = G[5][4] = 1;dfs( 1, 5, 0, 8 );return 0;}
- UVa 291 - The House Of Santa Claus
- uva 291The House Of Santa Claus
- UVA 291 The House Of Santa Claus 图的遍历
- UVA 291 The House Of Santa Claus(DFS算法)
- UVA 291 The House Of Santa Claus(DFS/深搜)
- uva 291 The house of santa claus DFS
- 291 - The House Of Santa Claus
- The House Of Santa Claus
- The House Of Santa Claus
- (DFS11.2.1)UVA 291 The House Of Santa Claus(使用DFS来解决一笔画问题)
- The House Of Santa Claus(dfs)
- (深度搜索)The House Of Santa Claus
- UVA291_The House Of Santa Claus(DFS)
- Santa Claus
- Santa claus would not come~
- Codeforces753A Santa Claus and Candies
- codeforces748c-Santa Claus and Robot
- 【codeforces 752C】Santa Claus and Robot
- LeetCode 3Sum
- javascript基础教程
- 捉蒋敢死队揭秘:1949年蒋介石惊险逃离大陆
- ubuntu中的VI编辑器按i进入文本编辑模式,按上下左右键显示ABCD字母
- eclipse修改默认工作空间
- UVa 291 - The House Of Santa Claus
- Ubuntu U盘挂载
- usaco McNuggets
- [Java-原创] bit、byte、位、字节、汉字、字符
- 邱少云牺牲惨状:火在身上烧了半小时
- Unity界面插件NGUI核心组件说明
- 计算机科学中最重要的32个算法(转)
- 主题:开发工程师的职场人生路(转)
- makefile: 静态模式