摘要:参考链接http://nightelf.sinaapp.com/2011/poj-1904-%E7%A1%AE%E5%AE%9A%E5%AE%8C%E5%85%A8%E4%BA%8C%E5%88%86%E5%8C%B9%E9%85%8D%E7%9A%84%E6%89%80%E6%9C%89%E5%8F%AF%E8%83%BD%E8%BE%B9.html题意:n个王子和n个美女要进行配对,每个王子可以喜欢若干个美女,但只能匹配其一个美女,求解每个王子能配对的美女使得其他王子也能成功配对,按升序输出王子能匹配的美女的编号。数据已经给出一个完备匹配。建图:王子到每个喜欢的美女连一条有向边,在给出的完
阅读全文
摘要:B - BCrawling in process... Crawling failed Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1256DescriptionYou are to write a program that has to generate all possible words from a given set of letters. Example: Given the word "abc", your
阅读全文
摘要:八数码问题有多种解法,本题解采用的是双向搜索View Code 1 #include<iostream> 2 #include<map> 3 #include<string> 4 #include<queue> 5 #include<stdio.h> 6 #include<string.h> 7 using namespace std; 8 structnode{ 9 stringsx; 10 int pos; 11 }; 12 13 int dir[4]={-3,1,3,-1}; 14 char ch1[4]={'
阅读全文