2013年8月22日

摘要: Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( using namespace std;const int maxn=1010;int fat[maxn];int Find(int x){ if (fat[x]!=x) fat[x]=Find(fat[x]); ... 阅读全文
posted @ 2013-08-22 16:47 不知妖精 阅读(141) 评论(0) 推荐(0) 编辑

2013年8月21日

摘要: Problem Description某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( using namespace std;const int maxn=110;int map[maxn][maxn];int dis[maxn];int used[maxn];const int INF=0x3fffffff;void prim(i 阅读全文
posted @ 2013-08-21 15:04 不知妖精 阅读(215) 评论(0) 推荐(0) 编辑

2013年8月20日

摘要: Problem Description有N个比赛队(1using namespace std;#include #include const maxn=550;int map[maxn][maxn];int in[maxn];int used[maxn];queue Q;void topol(int N,int M){ memset(map,0,sizeof(map)); memset(in,0,sizeof(in)); memset(used,0,sizeof(used)); int i,j; int a,b; int t; for (i=1;i>a... 阅读全文
posted @ 2013-08-20 17:13 不知妖精 阅读(251) 评论(0) 推荐(0) 编辑

2013年8月18日

摘要: Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(Nusing namespace std;#include int map[110][110];int used[110];int dis[110];int main(){ int N,M; int A,B,C; while (cin>>N>>M,N && 阅读全文
posted @ 2013-08-18 20:59 不知妖精 阅读(183) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std;struct node { int x,y; int step; //保存拐弯数}s,e;char map[110][110];int used[110][110];int Point[4][2]={1,0 ,-1,0 ,0,1 ,0,-1 };int bx,by,ex,ey,k,n,m;queue Q;int is_ok(int x,int y){ if (x>=1 && x=1 && y<=m && map[x][y]=='.&# 阅读全文
posted @ 2013-08-18 10:41 不知妖精 阅读(219) 评论(0) 推荐(0) 编辑

2013年8月17日

摘要: Oil DepositsTime Limit : 2000/1000ms (Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 41Accepted Submission(s) : 17Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem DescriptionThe GeoSurvComp geologic survey company is responsible for detecting underground oil d 阅读全文
posted @ 2013-08-17 11:29 不知妖精 阅读(158) 评论(0) 推荐(0) 编辑

2013年8月15日

摘要: #include #include using namespace std;int main(){ queue qa; queue qb; int T,N; int a; int lena,lenb; while (cin>>T) { while (T--) { cin>>N; for (int i=1;i<=N;i++) { qa.push (i); } if (qa.size ()<... 阅读全文
posted @ 2013-08-15 19:10 不知妖精 阅读(228) 评论(0) 推荐(0) 编辑

导航