上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 46 下一页
摘要: 二分查找:在一组数中找到指定的数 //1. 存储在数组中(如果是链表则无法使用二分查找) //2. 有序的排列 (递增或递减,或重复数都无影响) 递归法: //param:有序数组,检索开始为止,结束为止,要查找的数字 //return:返回目标数字所在为止,没有找到返回-1 int binSear 阅读全文
posted @ 2021-08-10 22:40 白玉神驹 阅读(220) 评论(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 @ 2021-08-09 23:05 白玉神驹 阅读(29) 评论(0) 推荐(0)
摘要: The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elev 阅读全文
posted @ 2021-08-09 17:47 白玉神驹 阅读(39) 评论(0) 推荐(0)
摘要: Given a sequence of K integers { N1​, N2​, ..., NK​ }. A continuous subsequence is defined to be { Ni​, Ni+1​, ..., Nj​ } where 1≤i≤j≤K. The Maximum S 阅读全文
posted @ 2021-08-09 16:06 白玉神驹 阅读(42) 评论(0) 推荐(0)
摘要: 动态规划算法的核心 //动态规划算法的核心就是记住已经解决过的子问题的解 通过动态规划解决斐波那契数列 //斐波那契数列(Fibonacci) //递归法 int fib(int n) { if (n == 0) return 0; if (n == 1) return 1; return fib( 阅读全文
posted @ 2021-08-08 18:51 白玉神驹 阅读(212) 评论(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 @ 2021-08-08 15:41 白玉神驹 阅读(35) 评论(0) 推荐(0)
摘要: Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specificat 阅读全文
posted @ 2021-08-07 12:01 白玉神驹 阅读(30) 评论(0) 推荐(0)
摘要: 1. 名称空间using namespace std的解释 //区分不同库中相同名称的函数、类、变量等。本质上,命名空间就是定义了一个范围。 //std是一个命名空间,C++标准函数或者对象都是在std中定义的,例如cin和cout,当我们要使用标准库的函数或对象时都需要用std来限定。 2. ci 阅读全文
posted @ 2021-08-06 22:21 白玉神驹 阅读(2358) 评论(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 @ 2021-08-06 18:10 白玉神驹 阅读(50) 评论(0) 推荐(0)
摘要: 基本概念: 深度优先搜索算法:一种用于遍历或搜索树或图的算法。沿着树的深度遍历树的节点,尽可能深的搜索树的分支。当节点V的所在边都已被搜寻过或者在搜寻时节点不满足,搜索将回溯到发现节点V的那条边的起始节点。整个过程反复进行直到所有节点都被访问为止。最糟糕时算法复杂度O(!n)。 输入样例: 6 a 阅读全文
posted @ 2021-08-06 16:58 白玉神驹 阅读(141) 评论(0) 推荐(0)
上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 46 下一页