HDU 4414 Finding crosses(dfs)】的更多相关文章

Problem Description The Nazca Lines are a series of ancient geoglyphs located in the Nazca Desert in southern Peru. They were designated as a UNESCO World Heritage Site in 1994. The high, arid plateau stretches more than 80 kilometres (50 mi) between…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4414 CSUST:点击打开链接 Finding crosses Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 729    Accepted Submission(s): 411 Problem Description The Nazca L…
题目链接:hdu 4414 其实是一道简单的字符型水题,不涉及任何算法,可比赛时却没能做出来,这几天的状态都差到家了... 题目大意是求有多少个满足条件的十字架,十字架的边不能有分叉路口,所以枚举每个点看是否满足条件就行,只是编码量的问题而已(感觉自己的码力不断下降了,我也不知道该怎么办好..) #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ][]; int n;…
题目链接 Problem Description There is a tree with n nodes, each of which has a type of color represented by an integer, where the color of node i is ci. The path between each two different nodes is unique, of which we define the value as the number of di…
排列2 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5817    Accepted Submission(s): 2229 Problem Description Ray又对数字的列产生了兴趣:现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数.   Input 每组数据占一行,代表四张卡片上的数…
题意:在N*N的图中,找出孤立存在的十字架的个数.十字架要求为正十字,孤立表示组成十字架的‘#的周围的一格再无’#‘. dfs找出在中心的‘#’(周围四格也为‘#'),则缩小了搜索范围,再bfs找出是否是符合要求. #include <cstdio> #include <iostream> #include <cmath> #include <cstring> #include <algorithm> using namespace std; c…
Problem Description I have N precious stones, and plan to use K of them to make a necklace for my mother, but she won't accept a necklace which is too heavy. Given the value and the weight of each precious stone, please help me find out the most valu…
Oil Deposits Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 4   Accepted Submission(s) : 3 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description The GeoSurvComp geologic s…
思路:一开始对k没有理解好,题意说交换k次,如果我们不需要交换那么多,那么可以重复自己交换自己,那么k其实可以理解为最多交换k次.这道题dfs暴力就行,我们按照全排列最大最小去找每一位应该和后面哪一位交换.k = 0没判断好WA了2发... 如果k >= len - 1,那么最大最小就是直接sort非前导零的答案.如果k < len - 1,那么我们交换肯定从最大位数交换,比如现在求最大值,那么我们从第一位依次判断,如果该位不是他后面最大的,那么就和后面最大的交换(如果最大的有多个,那么就每个…
Counting Cliques Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1855    Accepted Submission(s): 735 Problem Description A clique is a complete graph, in which there is an edge between every pai…