自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(31)
  • 资源 (1)
  • 收藏
  • 关注

原创 PAT甲级 1131 Subway Map (30)

1131 Subway Map (30 分)In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure shows the map of Beijing subway. Now you are supposed...

2019-02-19 11:50:05 215

原创 PAT甲级 1126 Eulerian Path (25)

1126 Eulerian Path (25 分)In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similarly, an Eulerian circuit is an Eulerian path which starts and ends on the ...

2019-02-18 14:56:20 166

原创 PAT甲级 1115 Counting Nodes in a BST (30)

1115 Counting Nodes in a BST (30 分)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 with keys le...

2019-02-03 17:48:40 138

原创 PAT甲级 1012 The Best Rank (25)

1012 The Best Rank (25 分)To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or L...

2019-01-01 23:35:55 128

原创 PAT甲级1010 Radix (25)

1010 Radix (25 分)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 binary number.Now for any pa...

2018-12-01 21:51:13 125

原创 PAT甲级1138 Postorder Traversal (25)

1138 Postorder Traversal (25 分)Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to output the first num...

2018-11-26 21:30:07 142

原创 PAT甲级1127 ZigZagging on a Tree (30)

1127 ZigZagging on a Tree (30 分)Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal s...

2018-11-24 20:04:09 154

原创 PAT甲级1119 Pre- and Post-order Traversals (30)

1119 Pre- and Post-order Traversals (30 分)Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder t...

2018-11-22 21:03:26 406 1

原创 PAT甲级1111 Online Map (30)

1111 Online Map (30 分)Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and the other...

2018-11-20 21:00:02 142

原创 PAT甲级 根据前中后序遍历建树总结

目前pat甲级涉及到的题目如下:               1020 Tree Traversals (25)      根据后序和中序建树,输出层序   1119 Pre- and Post-order Traversals (30)    根据前序和后序模拟树,输出中序          1127 ZigZagging on a Tree (30)       ...

2018-11-20 20:02:04 221

原创 PAT甲级1087 All Roads Lead to Rome (30)

1087 All Roads Lead to Rome (30 分)Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most hap...

2018-11-20 00:01:44 181

原创 PAT甲级1020 Tree Traversals (25)

1020 Tree Traversals (25 分)Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order ...

2018-11-19 00:00:26 146

原创 PAT甲级1072 Gas Station (30)

1072 Gas Station (30 分)A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must g...

2018-11-17 23:27:25 158

原创 PAT甲级1030 Travel Plan (30)

1030 Travel Plan (30 分)A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to d...

2018-11-16 23:00:09 120

原创 PAT甲级 最大连续子序列和

目前PAT甲级中涉及Dijkstra的题目有如下几题:                           1007 Maximum Subsequence Sum (25) 最大连续子序列和提供两种写法:1.动态规划(1)不记录起点和终点下标:int a[maxn],dp[maxn];//a[i]存放序列,dp[i]存放以a[i]结尾的连续序列的最大和dp[0]=a[0]...

2018-11-16 21:02:54 638

原创 PAT甲级1007 Maximum Subsequence Sum (25)

1007 Maximum Subsequence Sum (25 分)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≤i≤j≤K. The Maximum Su...

2018-11-16 20:55:31 107

原创 PAT甲级Dijkstra总结

目前PAT甲级中涉及Dijkstra的题目有如下几题:                                          1003 Emergency (25)                                 1018 Public Bike Management (30)                                         ...

2018-11-15 20:59:26 500

原创 PAT甲级1018 Public Bike Management (30)

1018 Public Bike Management (30 分)There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and ret...

2018-11-14 20:38:37 262

原创 PAT甲级1003 Emergency (25)

1003 Emergency (25 分)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 roads. Amount of rescue teams...

2018-11-14 20:28:23 113

原创 PAT考试细节

1.题目中如果待测的数据量大(一般在1e5的数据),或者一看就知道是卡时间的题,避免使用cin和cout来输入和输出,尽量使用scanf和printf,如果你有每道题都用scanf和printf的习惯那就忽略此点。2.有些题目需要设立inf最大(小)值来进行最小(大)值的更新,我们可以不用INT_MAX或者INT_MIN(还要引入头文件),可以设inf=10000000000非常大的数就可以了...

2018-11-13 22:41:25 743

原创 PAT甲级1038 Recover the Smallest Number (30)

这道题大意是给你一组数字,让你改变顺序自由组合最后要得到值最小的那个序列。先前按照自己的思路来做才得了20分应该还有某种情况没有考虑到,答案却十分简洁,我们必须要用string对象接受数字,利用字符串拼接后比较大小进行自定义排序:#include<iostream>#include<string>#include<algorithm>using ...

2018-08-22 19:27:30 278

原创 MIT线性代数:9.线性相关性、基、维数

1.向量组的线性相关性线性相关的定义:给定一组向量(x1,x2,x3...xn),除了他们系数等于0相加后值为0之外,如果还存在一组数使得他们相加等于0,那么称这组向量线性相关,否则线性无关。(也就是零空间N(A)中存在非0向量则为线性无关)如果一组向量中包含0向量那么这组向量是线性相关的,因为我门可以取任意倍的0向量,其余向量系数取0,那么就可以得到0向量了。一个二维空间中有三个不共...

2018-07-29 19:18:35 650

原创 MIT线性代数:8.求解Ax=b:可解性和解的结构

1.Ax=b最后消元得到:所以可以得出有解的条件是:1.1Ax=b可解性(1)从列空间看:b必须满足是A各列的线性组合,当然这也是方程组有解的要求。(2)如果A的各行经过线性组合得到零行,那么b经过相同的线性组合也必须得到零行。1.2Ax=b的解结构1.特解(Xp):经过消元之后,把自由变量全赋值为0(自由变量可以自由赋值,自由变量是经过特定赋值的解...

2018-07-25 20:27:29 5843

原创 MIT线性代数:7.求解Ax=0:主变量、特解

1.零空间(Ax=0)上面为矩阵A,然后我们对A进行消元,因为消元是行变换不会改变Ax=0的解,零空间也不会改变,会改变的是列空间最后得到消元结果(上三角矩阵)   这个U又可以说是阶梯形式的矩阵(echelon form),第一列和第三列为主元列,而其余的列为自由列,这时定义了一个rank秩,它是矩阵中主元个个数,本例rank=2,现在我们变成了Ux=0,解和零空间不变。...

2018-07-22 19:24:23 936

原创 MIT线性代数:6.列空间和零向量

1.列空间该矩阵A是R^4空间的子空间(因为是4*3的矩阵,是四维向量),这个子空间是A的列空间所有列的线性组合。那么他对于每个Ax=b的每个b是否都有解呢?(也就是什么样的b才会使得Ax=b有解)3个列向量的线性组合无法充满整个四维空间,因此有大量的b不是这三个向量的线性组合,因为三个向量的线性组合也许是四维空间中的一个平面,三个未知数四个方程通常是无解的,但是上面这种情况却有解...

2018-07-18 20:37:21 1273

原创 MIT线性代数:5.转置-置换-向量空间R

1.置换矩阵就是上节课所说的单位矩阵进行行变换得到的一系列矩阵。2.矩阵的转置Aij = Aji2.1对称矩阵对称矩阵的转置等于其本身,也可以说是转置后等于本身的成为对称矩阵。一个矩阵乘以他的转置会得到一个对称矩阵证明:也就是证明该矩阵相乘后的转置等于矩阵相乘本身,所以满足对称矩阵的性质。3.向量空间什么是向量空间?向量空间有很多向量,一整个...

2018-07-12 19:58:38 664

原创 MIT线性代数:4.矩阵A的LU分解

1.回顾逆矩阵乘以逆矩阵得到单位阵需要反着乘。第二行是第一行两边同时转置的结果,得到的结论是A转置的逆是A的逆的转置。2.A=LUL是LOWER也就是下三角矩阵,U是UPPER也就是上三角矩阵。2.1A=LU先是由E初等矩阵消元从A变化到U。L与E是什么关系呢?答案是互为逆矩阵。2.2A=LDU有时候我们也可以把主元单独分离出来,得到D。2.3L的求解求逆的顺序要反过来,则L是这些逆的积。为什么要...

2018-07-10 19:30:44 2609

原创 MIT线性代数:3.矩阵的乘法和逆矩阵

1.矩阵乘法1.1行, 列点乘法C的第三行四列等于A的第三行乘以B的第四列,同理可得C的其余元素的值。假设A为m*n,B为n*p,那么C的形状就是m*p。1.2列方法C的一列对应的就是A乘以B的对应一列(C的第一列就是A乘以B的第一列),可以看成A的各列的线性组合,而B则是告诉我们A是怎样进行线性组合的。1.3行方法C的一行对应的就是B乘以A的对应一行,可以看成B的各行的线性组合,而A则是告诉我们...

2018-07-08 21:50:25 623

原创 MIT线性代数:2.矩阵消元

1.消元法本课的核心是矩阵变化,也就是矩阵乘法1.1消元同样是矩阵表示系数1. 确定主元(0不能为主元),主元下方的元素消成0,例(2,1)过程,第二行减去三倍的第一行(相当于方程组第二个方程减去三倍的第一个方程),把(2,1)的值消成0,进而确定了(2,2)的元素为主元,同理第三行减去两倍的第二行把(3,2)消成0。消完元的矩阵称为U。消元法失效的情况:当主元上为 0 时,就通过交换行将主元位置...

2018-07-05 20:09:50 471

原创 PAT乙级1068 万绿丛中一点红(20 分)

这道题注意题目中的“独一无二”,就是必须这个点只能出现一次。与其8个周围的点并不是指只能在内圈进行扫描,在最外圈也必须扫描,8个周围的点意思表达不明确。最后没法通过一个超时的例子,需要把cin换成scanf,因为cin效率比scanf效率低很多。这就是这道题的几个坑点。下面代码:#include<iostream>#include<vector>#include<...

2018-07-05 15:29:20 1000

原创 MIT线性代数:1.方程组的几何解释

1.方程组可用矩阵进行表示如下:系数矩阵A,未知数向量x,右侧向量为b,则可写成Ax=b1.1行图像针对上面的矩阵,可以用行图像进行表示如图,二维矩阵的行图像是在平面内交于一点,交点(1,2)即为矩阵的解1.2列图像列图像关注的是矩阵的列,一个向量,在坐标上表示:当1个x向量和2个y向量所交的点为b代表的向量(0,3)此矩阵的解就是(1,2)1.3扩展到三维此方程对应的行图像是空间的三维的,也就是...

2018-06-29 20:22:47 287

notmnist代码

notmnist数据集处理与分类,精度可有98%.。。。。。。。。。。。。。

2018-03-24

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除