摘要: L2-006 树的遍历 (25 分) 给定一棵二叉树的后序遍历和中序遍历,请你输出其层序遍历的序列。这里假设键值都是互不相等的正整数。 输入格式: 输入第一行给出一个正整数N(≤30),是二叉树中结点的个数。第二行给出其后序遍历序列。第三行给出其中序遍历序列。数字间以空格分隔。 输出格式: 在一行中 阅读全文
posted @ 2019-02-27 22:01 可怕hiahia 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 给定一个长度为N的数列,A1, A2, ... AN,如果其中一段连续的子序列Ai, Ai+1, ... Aj(i <= j)之和是K的倍数,我们就称这个区间[i, j]是K倍区间。你能求出数列中总共有多少个K倍区间吗? 给定一个长度为N的数列,A1, A2, ... AN,如果其中一段连续的子序列 阅读全文
posted @ 2019-02-27 21:04 可怕hiahia 阅读(107) 评论(0) 推荐(0) 编辑
摘要: B - Array K-Coloring You are given an array aa consisting of nn integer numbers. You have to color this array in kk colors in such a way that: Each el 阅读全文
posted @ 2019-02-27 18:23 可怕hiahia 阅读(200) 评论(0) 推荐(0) 编辑