HDU.P1100 Trees Made to Order 解题报告】的更多相关文章

http://www.cnblogs.com/keam37/p/3637717.html  keam所有 转载请注明出处 Problem Description We can number binary trees using the following scheme: 我们用下面的规则来给一颗二叉树编号: The empty tree is numbered 0. 空树编号为0. The single-node tree is numbered 1. 只有一个节点的树编号为1. All bin…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 排序 日期 题目地址:https://leetcode.com/problems/matrix-cells-in-distance-order/ 题目描述 We are given a matrix with R rows and C columns has cells with integer coordinates (r, c), where 0…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 模拟 日期 题目地址:https://leetcode.com/problems/reveal-cards-in-increasing-order/description/ 题目描述 In a deck of cards, every card has a unique integer. You can order the deck in any o…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1002 题目意思:就是大整数加法. 两年几前做的,纯粹是整理下来的. #include <stdio.h> #include <string.h> #define max 1010 char a[max], b[max]; int main() { int i, k, s, c, T, len1, len2; scanf("%d", &T); ; k <…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 用STL 中的 Map 写的 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <string> #include <map> using namespace std; map<string, int>…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2066 题目意思:给出T条路,和草儿家相邻的城市编号,以及草儿想去的地方的编号.问从草儿家到达草儿想去的地方的最短时间是多少. 一开始自己写的只能处理单边出发的情况,对于以下这幅图,只能处理箭头所示的方向,不能向下,于是不知道为什么出现了百年难得一遇的Runtime Error(ACCESS_VIOLATION)! 10 2 31 3 53 8 42 5 25 8 31 4 74 9 129 10 2…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2680 题目意思:实质就是给定一个多源点到单一终点的最短路. 卑鄙题---有向图.初始化map时 千万不要写成 map[i][j] = map[j][i] = X. #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; #de…
转载大佬的blog,很详细,学到了很多东西 奇偶剪枝:根据题目,dog必须在第t秒到达门口.也就是需要走t-1步.设dog开始的位置为(sx,sy),目标位置为(ex,ey).如果abs(ex-x)+abs(ey-y)为偶数,则abs(ex-x)和abs(ey-y)奇偶性相同,所以需要走偶数步: 当abs(ex-x)+abs(ey-y)为奇数时,则abs(ex-x)和abs(ey-y)奇偶性不同,到达目标位置就需要走奇数步.先判断奇偶性再搜索可以节省很多时间,不然的话容易超时.t-sum为到达目…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 mutex锁 promise/future 日期 题目地址:https://leetcode.com/problems/print-in-order/ 题目描述 Suppose we have a class: public class Foo { public void first() { print("first"); } public…
题目链接:http://poj.org/problem?id=2013 设长度非递减的字串序列为s[1]...s[n].设计递归子程序print(n),其中n为字串序号,每分析1个字串,n=n-1. n = 0 为边界.字串s为局部变量: 先输入和输出当前组的第1个字串s,n = n - 1: 若n > 0,则输入当前组的第2个字符s,n = n - 1.若n > 0,则通过递归调用print(n)将字串s入栈.回溯过程相当于栈顶字串s出栈,因此直接输出s. #include <iost…