Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square? InputThe first line of input contains N, the number ...
分类:
其他好文 时间:
2020-07-27 09:42:59
阅读次数:
80
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2544 题意 给出一个 $n$ 点 $m$ 边的带权无向图,找出结点 $1$ 到结点 $n$ 的路径最小权。($n \le 100, m \le 10000$) 题解 $n$ 的范围较小,可以用 $O_{ ...
分类:
其他好文 时间:
2020-07-27 09:38:16
阅读次数:
51
When you go shopping, you can search in repository for avalible merchandises by the computers and internet. First you give the search system a name ab ...
分类:
其他好文 时间:
2020-07-27 09:29:30
阅读次数:
82
//判断输入的数字是否可以构成一棵树 //前一个数是后一个的父亲节点,树的定义:有且仅有一个总根节点,根节点到其他任意节点路径唯一,每个节点只能被其根指向,入度只能为1 #include <stdio.h> #include <string.h> #define maxn 10002 int in[ ...
分类:
其他好文 时间:
2020-07-27 09:18:05
阅读次数:
68
import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class hdu1518DFS{ private static boolean [] vis; private static ...
分类:
其他好文 时间:
2020-07-26 19:26:13
阅读次数:
69
题目描述 https://leetcode-cn.com/problems/subtree-of-another-tree/ 题解 我写的 两层DFS、双重DFS 其它题解一般也是这个思路 // Problem: LeetCode 572 // URL: https://leetcode-cn.co ...
分类:
其他好文 时间:
2020-07-26 19:01:52
阅读次数:
62
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6756 CSDN食用链接:https://blog.csdn.net/qq_43906000/article/details/107590312 Problem Description Given an ...
分类:
其他好文 时间:
2020-07-26 15:58:23
阅读次数:
139
A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between ...
分类:
其他好文 时间:
2020-07-26 02:05:42
阅读次数:
102
A. Poker (Hdu ????) 题目大意 给定n个币,每次投至少m个,当投$x$个时,给回$\lfloor x \times (1 - p %) \rfloor$。问你最多能投多少次。 解题思路 很显然每次投$m$元是最优的,因为但凡投$m+1$元,给回的钱数不可能会增加二,要不不变要不减少 ...
分类:
其他好文 时间:
2020-07-26 01:12:43
阅读次数:
213
题目链接 https://leetcode-cn.com/problems/path-sum/ 题解一 我自己写的 在dfs过程中要记录当前节点与根节点之间的距离,并且回溯时也需要更新该值 注意要求是叶子节点到根节点之间的距离 详细思路见代码注释 // Problem: LeetCode 112 / ...
分类:
其他好文 时间:
2020-07-26 00:50:35
阅读次数:
60