B. 2Trees time limit per test 0.75 seconds memory limit per test 256 megabytes input standard input output standard output You are given two trees with the same number of leaves L, your task is to merge the two trees' leaves in a way that ensures the…
C. Arcade time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Abdullah and Haritha were building a 3D printed arcade machine. Abdullah had worked on the hardware, while Haritha had been working…
"我是要成为海贼王的男人!" 路飞他们伟大航路行程的起点是罗格镇,终点是拉夫德鲁(那里藏匿着"唯一的大秘宝"--ONE PIECE).而航程中间,则是各式各样的岛屿. 因为伟大航路上的气候十分异常,所以来往任意两个岛屿之间的时间差别很大,从A岛到B岛可能需要1天,而从B岛到A岛则可能需要1年.当然,任意两个岛之间的航行时间虽然差别很大,但都是已知的. 现在假设路飞一行从罗格镇(起点)出发,遍历伟大航路中间所有的岛屿(但是已经经过的岛屿不能再次经过),最后到达拉夫德鲁…
题目链接:http://poj.org/problem?id=2488 思路:按照一定的字典序深搜,当时我的想法是把所有的可行的路径都找出来,然后字典序排序. 后来,凡哥说可以在搜索路径的时候就按照字典序搜索,这样一找到可行的路径就输出来就行了.这里我吸取了之前八皇后问题时犯的错,并且优化了一下写法,就是flag,这是参考了jhf大神的写法了. 但是jhf大神的写法,思路和我一样,但是他的x,y坐标还要转来转去,我就没有这么写了,还是按照我的代码风格好一些. #include <stdio.h>…
题目链接:https://vijos.org/p/1159 https://www.luogu.org/problem/show?pid=1494 这是今天的第三道迭代深搜的题,虽然都是迭代深搜的模板,都是一些基础题,但是还是觉得自己不行啊... 拿到题目后我就有了一个大胆的想法 然后自己仔细斟酌之后我就pass了他...我原本想在dfs中来记录下有几种水桶,现在询问的是哪一个水桶,当前这个水桶选了几个... 然而,这个想法实在是太大胆了.......在一番斟酌之后,我想到了一个神奇的东西叫记忆…
这个题我看了,都是推荐的神马双向广搜,难道这个深搜你们都木有发现?还是特意留个机会给我装逼? Open the Lock Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3014    Accepted Submission(s): 1323 Problem Description Now an emergent task for you…
利用TreeView控件加载文件,必须遍历处所有的文件和文件夹. 深搜算法用到了递归. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows…
题目链接 https://acm.bnu.edu.cn/v3/problem_show.php?pid=52310 problem description Define the depth of a node in a rooted tree by applying the following rules recursively: • The depth of a root node is 0. • The depths of child nodes whose parents are with…
题目链接 https://acm.bnu.edu.cn/v3/problem_show.php?pid=52305 problem  description In ICPCCamp, there are n cities and (n−1) (bidirectional) roads between cities. The i-th road is between the ai-th and bi-th cities. It is guaranteed that cities are conne…
题目链接:HDU 5355 http://acm.split.hdu.edu.cn/showproblem.php?pid=5355 Problem Description There are m soda and today is their birthday. The 1-st soda has prepared n cakes with size 1,2,…,n. Now 1-st soda wants to divide the cakes into m parts so that th…