上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 44 下一页
摘要: Given a sequence of K integers { N​1​​, N​2​​, ..., N​K​​ }. A continuous subsequence is defined to be { N​i​​, N​i+1​​, ..., N​j​​ } where 1. The Max 阅读全文
posted @ 2019-07-11 21:44 自由之翼Az 阅读(206) 评论(0) 推荐(0) 编辑
摘要: At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door 阅读全文
posted @ 2019-07-11 20:29 自由之翼Az 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 题目描述 输入描述: 输出描述: 输入例子: 输出例子: 阅读全文
posted @ 2019-07-11 20:08 自由之翼Az 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 【题目】 一个栈中元素的类型为整型,现在想将该栈从顶到底按从大到小的顺序排序,只许申请一个栈。除此之外,可以申请新的变量,但不能申请额外的数据结构。如何完成排序? 【题解】 将要排序的栈记为stack,申请的辅助栈记为help。在stack上执行pop操作,弹出的元素记为cur。·如果cur小于或等 阅读全文
posted @ 2019-07-11 15:58 自由之翼Az 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 【题目】一个栈依次压入1、2、3、4、5,那么从栈顶到栈底分别为5、4、3、2、1。将这个栈转置后,从栈顶到栈底为1、2、3、4、5,也就是实现栈中元素的逆序,但是只能用递归函数来实现,不能用其他数据结构。 【题解】使用两个递归函数:一个递归函数是将栈底的元素返回并删除另一个函数是将返回的元素进行存 阅读全文
posted @ 2019-07-11 15:43 自由之翼Az 阅读(220) 评论(0) 推荐(0) 编辑
摘要: A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Specification: Each inp 阅读全文
posted @ 2019-07-11 14:36 自由之翼Az 阅读(166) 评论(0) 推荐(0) 编辑
摘要: As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some ro 阅读全文
posted @ 2019-07-10 23:13 自由之翼Az 阅读(198) 评论(0) 推荐(0) 编辑
摘要: Djkstra算法示例演示 下面我求下图,从顶点v1到其他各个顶点的最短路径 首先第一步,我们先声明一个dis数组,该数组初始化的值为: 我们的顶点集T的初始化为:T={v1} 既然是求 v1顶点到其余各个顶点的最短路程,那就先找一个离 1 号顶点最近的顶点。通过数组 dis 可知当前离v1顶点最近 阅读全文
posted @ 2019-07-10 23:02 自由之翼Az 阅读(774) 评论(0) 推荐(0) 编辑
摘要: This time, you are supposed to find A+B where A and B are two polynomials. Input Specification: Each input file contains one test case. Each case occu 阅读全文
posted @ 2019-07-09 20:06 自由之翼Az 阅读(223) 评论(0) 推荐(0) 编辑
摘要: Calculate a+b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less tha 阅读全文
posted @ 2019-07-09 19:01 自由之翼Az 阅读(198) 评论(0) 推荐(0) 编辑
上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 44 下一页