摘要: The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants. Given any two nodes in a bin 阅读全文
posted @ 2020-03-21 21:51 zzzlight 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题干前半略。 Sample Input 1: 8 98 72 86 60 65 12 23 50 Sample Output 1: 98 86 23 98 86 12 98 72 65 98 72 60 50 Max Heap Sample Input 2: 8 8 38 25 58 52 82 7 阅读全文
posted @ 2020-03-21 21:47 zzzlight 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 题目前半略 Sample Input: 10 11 8 7 6 8 4 5 8 4 8 1 1 2 1 4 9 8 9 1 1 0 2 4 4 0 1 0 1 4 1 0 1 3 0 0 1 0 1 4 1 0 1 0 0 8 1 0 1 4 1 0 5 3 0 1 2 3 4 5 6 7 8 8 阅读全文
posted @ 2020-03-21 21:45 zzzlight 阅读(158) 评论(0) 推荐(0) 编辑
摘要: A registration card number of PAT consists of 4 parts: the 1st letter represents the test level, namely, T for the top level, A for advance and B for 阅读全文
posted @ 2020-03-21 21:43 zzzlight 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 题干前半略。 Input Specification: Each input file contains one test case. Each case first gives in a line two positive integers: L (≤ 1,000) and K (< 10), w 阅读全文
posted @ 2020-03-21 21:40 zzzlight 阅读(204) 评论(0) 推荐(0) 编辑
摘要: The "travelling salesman problem" asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shor 阅读全文
posted @ 2020-03-21 21:38 zzzlight 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that 阅读全文
posted @ 2020-03-21 21:37 zzzlight 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 此题题干略 Sample Input: 4 7 1001 3212 1003 1204 1005 1306 7797 9 9988 2333 1204 2006 2005 2004 2003 2302 2001 13 3011 3812 3013 3001 1306 3003 2333 3066 3 阅读全文
posted @ 2020-03-21 21:34 zzzlight 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Sample Input: 6 6 7 01234 880 a1903 199 ydjh2 200 wehu8 300 dx86w 220 missing 400 ydhfu77 99 wehu8 55 ydjh2 98 dx86w 88 a1903 86 01234 39 ydhfu77 88 a 阅读全文
posted @ 2020-03-21 21:29 zzzlight 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years. When a boy A had a crush on a g 阅读全文
posted @ 2020-03-21 21:27 zzzlight 阅读(163) 评论(0) 推荐(0) 编辑
摘要: British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number", E -- tha 阅读全文
posted @ 2020-03-21 21:25 zzzlight 阅读(135) 评论(0) 推荐(0) 编辑
摘要: The basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complicated is that some of the input n 阅读全文
posted @ 2020-03-21 21:24 zzzlight 阅读(112) 评论(0) 推荐(0) 编辑
摘要: Given two sets of integers, the similarity of the sets is defined to be /, where N​c​​ is the number of distinct common numbers shared by the two sets 阅读全文
posted @ 2020-03-21 21:22 zzzlight 阅读(190) 评论(0) 推荐(0) 编辑
摘要: Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to ou 阅读全文
posted @ 2020-03-21 21:17 zzzlight 阅读(153) 评论(0) 推荐(0) 编辑
摘要: There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any s 阅读全文
posted @ 2020-03-21 21:12 zzzlight 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 在c与c++中,有多种办法可以通过函数交换传入的两数的值,但有容易有一些问题产生,因而本文将几种交换方式及容易出错的点进行了分类。 1.传引用这是c++中最常见方式如下: int swap1 (int &a,int &b) { int c; c=a; a=b; b=c; cout<<"a1:"<<a 阅读全文
posted @ 2020-03-21 21:03 zzzlight 阅读(1356) 评论(0) 推荐(0) 编辑
摘要: 1.先cd切换到工作的目录 2.进入项目文件夹,通过命令git init将项目初始化成git本地仓库 git init 2、将项目内所有文件都添加到暂存区 git add . //用.是当前目录,也可自己选择文件加入 3、对本次的提交进行备注,以便后期版本回退等操作 git commit -m 'x 阅读全文
posted @ 2020-03-21 20:34 zzzlight 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 在使用getline读入一整行时,若是前面是使用getchar()、cin这类读入了一个字母,但是不会读入后续换行\n符号或者空格的输入时,再接getline()就容易出现问题。 这是因为输入数字之后,敲回车,产生的换行符仍然滞留在输入流了,接着就被getline(cin,s)给读进去了,此时的s= 阅读全文
posted @ 2020-03-21 19:59 zzzlight 阅读(3625) 评论(0) 推荐(0) 编辑