UVA 539 - The Settlers of Catan 解题报告
来源:互联网 发布:java手机模拟器安卓版 编辑:程序博客网 时间:2024/06/05 02:51
搜索即可,图为无向图。找出能走的不重复的边的最大数
#include <iostream>#include<cstring>#include<algorithm>#include<fstream>#define maxn 30using namespace std;int map[maxn][maxn];int vis[maxn][maxn];int point_num;int edge_num;int max_num;void dfs(int n,int num){ if(num>max_num) max_num=num; for(int i=0;i<point_num;i++) { if(i!=n&&!vis[n][i]&&map[n][i]) { vis[n][i]=1; vis[i][n]=1; dfs(i,num+1); vis[n][i]=0; vis[i][n]=0; } }}int main(){ while(cin>>point_num>>edge_num) { if(0==point_num&&0==edge_num) break; memset(map,0,sizeof(map)); memset(vis,0,sizeof(vis)); max_num=0; for(int i=0;i<edge_num;i++) { int a,b; cin>>a>>b; map[a][b]=1; map[b][a]=1; } for(int i=0;i<point_num;i++) { dfs(i,0); } cout<<max_num<<endl; } return 0;}
- UVA 539 - The Settlers of Catan 解题报告
- UVa 539 The Settlers of Catan
- Uva 539 The Settlers of Catan
- uva 539 - The Settlers of Catan
- uva 539 - The Settlers of Catan
- uva 539 - The Settlers of Catan
- UVa 539 - The Settlers of Catan
- UVA 539 - The Settlers of Catan
- UVa 539 - The Settlers of Catan
- uva 539 The Settlers of Catan
- uva 539 - The Settlers of Catan
- UVA 539 The Settlers of Catan
- uva 539 The Settlers of Catan
- UVA 539 The Settlers of Catan
- uva 539 The Settlers of Catan
- UVa 539 - The Settlers of Catan
- uva 539 - The Settlers of Catan
- uva 539 The Settlers of Catan
- memcache c操作
- C++调用python,直接调用模块内函数,调用类内函数
- 如何欣赏音乐(四)
- FastDB分析
- “兼容模式”错杂谈
- UVA 539 - The Settlers of Catan 解题报告
- 什么是webservice,什么情况下使用,如何使用?
- codeforces 148 Not Wool Sequences
- Session,有没有必要使用它?
- loner_li 机试题 现有1~100共一百个自然数,已随机放入一个有98个元素的数组a[98]。
- [在线监控]MongoDB Monitoring Service 学习笔记 SYBN
- Apache Hadoop最佳实践和反模式
- 推荐两款富文本编辑器:NicEdit和Kindeditor
- CLR_Via_C#学习笔记之事件