上一页 1 2 3 4 5 6 7 8 9 ··· 50 下一页
摘要: P1364 医院设置 题目描述 设有一棵二叉树,如图: 其中,圈中的数字表示结点中居民的人口。圈边上数字表示结点编号,现在要求在某个结点上建立一个医院,使所有居民所走的路程之和为最小,同时约定,相邻接点之间的距离为 11。如上图中,若医院建在1 处,则距离和 =4+12+2\times20+2\ti 阅读全文
posted @ 2020-06-09 17:24 SteveYu 阅读(121) 评论(0) 推荐(0) 编辑
摘要: P5076 【深基16.例7】普通二叉树(简化版) 题目描述 您需要写一种数据结构,来维护一些数( 都是 109109 以内的数字)的集合,最开始时集合是空的。其中需要提供以下操作,操作次数 qq 不超过 104104: 查询 xx 数的排名(排名定义为比当前数小的数的个数 +1+1。若有多个相同的 阅读全文
posted @ 2020-06-09 16:25 SteveYu 阅读(261) 评论(0) 推荐(0) 编辑
摘要: P1827 [USACO3.4]美国血统 American Heritage 题目描述 农夫约翰非常认真地对待他的奶牛们的血统。然而他不是一个真正优秀的记帐员。他把他的奶牛 们的家谱作成二叉树,并且把二叉树以更线性的“树的中序遍历”和“树的前序遍历”的符号加以记录而 不是用图形的方法。 你的任务是在 阅读全文
posted @ 2020-06-05 19:58 SteveYu 阅读(474) 评论(0) 推荐(0) 编辑
摘要: P4913 【深基16.例3】二叉树深度 题目描述 给出每个节点的两个儿子节点,建立一棵二叉树(根节点为 11),如果是叶子节点,则输入0 0。建好树后希望知道这棵二叉树的深度。二叉树的深度是指从根节点到叶子结点时,最多经过了几层。 最多有 10^6106 个结点。 输入格式 无 输出格式 无 输入 阅读全文
posted @ 2020-06-05 19:45 SteveYu 阅读(445) 评论(0) 推荐(0) 编辑
摘要: 题目描述 有 2^n(n\le7)2n(n≤7) 个国家参加世界杯决赛圈且进入淘汰赛环节。我经知道各个国家的能力值,且都不相等。能力值高的国家和能力值低的国家踢比赛时高者获胜。1 号国家和 2 号国家踢一场比赛,胜者晋级。3 号国家和 4 号国家也踢一场,胜者晋级……晋级后的国家用相同的方法继续完成 阅读全文
posted @ 2020-06-05 19:30 SteveYu 阅读(238) 评论(0) 推荐(1) 编辑
摘要: Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of b 阅读全文
posted @ 2020-05-18 14:12 SteveYu 阅读(216) 评论(1) 推荐(1) 编辑
摘要: The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed 阅读全文
posted @ 2020-05-18 14:11 SteveYu 阅读(132) 评论(0) 推荐(0) 编辑
摘要: A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find t 阅读全文
posted @ 2020-05-18 14:03 SteveYu 阅读(208) 评论(0) 推荐(0) 编辑
摘要: Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the g 阅读全文
posted @ 2020-05-18 14:00 SteveYu 阅读(215) 评论(0) 推荐(0) 编辑
摘要: Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3×5×6×7, where 5, 6, a 阅读全文
posted @ 2020-05-17 16:19 SteveYu 阅读(247) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each va 阅读全文
posted @ 2020-05-17 16:16 SteveYu 阅读(141) 评论(0) 推荐(0) 编辑
摘要: According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert 阅读全文
posted @ 2020-05-17 16:15 SteveYu 阅读(178) 评论(0) 推荐(0) 编辑
摘要: A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes 阅读全文
posted @ 2020-05-17 15:33 SteveYu 阅读(260) 评论(0) 推荐(0) 编辑
摘要: People on Mars count their numbers with base 13: Zero on Earth is called "tret" on Mars. The numbers 1 to 12 on Earth is called "jan, feb, mar, apr, m 阅读全文
posted @ 2020-05-16 14:59 SteveYu 阅读(203) 评论(0) 推荐(0) 编辑
摘要: There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then th 阅读全文
posted @ 2020-05-16 14:57 SteveYu 阅读(189) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 50 下一页