随笔分类 -  C++学习

从入门到PAT
摘要:1.1 数据结构基本概念 数据结构(data structure)是相互之间存在一种或多种特定关系的数据元素的集合 1.2 基本结构 数据元素相互之间的关系称为结构,数据元素之间关系的不同特性,4类基本结构:1. 集合 2. 线性结构 3. 树形结构 4. 图状结构或网状结构 1.3 基本原理 1. 阅读全文
posted @ 2021-09-04 23:09 白玉神驹 阅读(467) 评论(0) 推荐(0)
摘要:考查目标 1. 掌握数据结构的基本概念、基本原理和基本方法; 2. 掌握数据结构的逻辑结构、存储结构及基本操作的实现,能够对算法进行基本的时间复杂度与空间复杂度的分析; 3. 能应用数据结果基本原理和方法进行问题的分析与求解,具备采用C或C++语言设计与实现算法的能力。 一、栈、队列和数组 (一)栈 阅读全文
posted @ 2021-09-04 22:23 白玉神驹 阅读(119) 评论(0) 推荐(0)
摘要:A long-distance telephone company charges its customers by the following rules: Making a long-distance call costs a certain amount per minute, dependi 阅读全文
posted @ 2021-09-02 23:30 白玉神驹 阅读(53) 评论(0) 推荐(0)
摘要:A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a re 阅读全文
posted @ 2021-09-01 18:18 白玉神驹 阅读(44) 评论(0) 推荐(0)
摘要:Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules 阅读全文
posted @ 2021-08-26 20:45 白玉神驹 阅读(71) 评论(0) 推荐(0)
摘要:It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that c 阅读全文
posted @ 2021-08-20 14:16 白玉神驹 阅读(44) 评论(0) 推荐(0)
摘要:To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mat 阅读全文
posted @ 2021-08-19 14:31 白玉神驹 阅读(45) 评论(0) 推荐(0)
摘要:With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing ba 阅读全文
posted @ 2021-08-11 16:00 白玉神驹 阅读(46) 评论(0) 推荐(0)
摘要:Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a 阅读全文
posted @ 2021-08-11 14:13 白玉神驹 阅读(46) 评论(0) 推荐(0)
摘要:二分查找:在一组数中找到指定的数 //1. 存储在数组中(如果是链表则无法使用二分查找) //2. 有序的排列 (递增或递减,或重复数都无影响) 递归法: //param:有序数组,检索开始为止,结束为止,要查找的数字 //return:返回目标数字所在为止,没有找到返回-1 int binSear 阅读全文
posted @ 2021-08-10 22:40 白玉神驹 阅读(219) 评论(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 白玉神驹 阅读(2357) 评论(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)
摘要: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 @ 2021-08-05 17:15 白玉神驹 阅读(42) 评论(0) 推荐(0)