自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 收藏
  • 关注

原创 PAT甲 2019年秋季考试 7-1 Forever (20 分) DFS+剪枝

7-1 Forever (20分) “Forever number” is a positive integer A with K digits, satisfying the following constrains: the sum of all the digits of A is m; the sum of all the digits of A+1 is n; and the great...

2020-02-21 21:10:57 315

原创 PAT甲 7-4 Cartesian Tree (30分) 两种解法

7-4 Cartesian Tree (30分) A Cartesian tree is a binary tree constructed from a sequence of distinct numbers. The tree is heap-ordered, and an inorder traversal returns the original sequence. For exampl...

2020-02-19 18:03:10 387

原创 PAT(甲级)2019年冬季考试 7-3 Summit (25分)

7-3 Summit (25分) A summit (峰会) is a meeting of heads of state or government. Arranging the rest areas for the summit is not a simple job. The ideal arrangement of one area is to invite those heads so ...

2020-02-19 17:56:39 203

原创 PAT(甲级)2019年冬季考试 7-2 Block Reversing (25分)

7-2 Block Reversing (25分) Given a singly linked list L. Let us consider every K nodes as a block (if there are less than K nodes at the end of the list, the rest of the nodes are still considered as a...

2020-02-19 17:51:29 269

原创 PAT(甲级)2019年冬季考试 7-1 Good in C (20分)

7-1 Good in C (20分) When your interviewer asks you to write “Hello World” using C, can you do as the following figure shows? Input Specification: Each input file contains one test case. For each case...

2020-02-19 17:45:20 294

原创 PAT甲级 1102 Invert a Binary Tree

A1102 Invert a Binary Tree (25 分) The following is from Max Howell @twitter: Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so f...

2019-07-22 16:00:34 122

原创 PAT甲级 A1039 Course List for Student

A1039 Course List for Student (25 分)** Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered ...

2019-07-17 11:33:41 138

原创 "分析"二分法

讨论1.5 分析“二分法” 来自 MOOC 浙江大学 数据结构 查找算法中的“二分法”是这样定义的: 给定N个从小到大排好序的整数序列List[],以及某待查找整数X,我们的目标是找到X在List中的下标。即若有List[i]=X,则返回i;否则返回-1表示没有找到。 二分法是先找到序列的中点List[M],与X进行比较,若相等则返回中点下标;否则,若List[M]>X,则在左边...

2018-09-15 14:47:10 1087 1

原创 PAT(Basic Level) 乙级 1090 危险品装箱

1090 危险品装箱(25 分) 集装箱运输货物时,我们必须特别小心,不能把不相容的货物装在一只箱子里。比如氧化剂绝对不能跟易燃液体同箱,否则很容易造成爆炸。 本题给定一张不相容物品的清单,需要你检查每一张集装箱货品清单,判断它们是否能装在同一只箱子里。 输入格式: 输入第一行给出两个正整数:N (≤10^​4​​ ) 是成对的不相容物品的对数;M (≤100) 是集装箱货品清单的单数...

2018-09-11 19:58:27 410

原创 PAT(Basic Level) 乙级 1088 三人行

PAT乙级 1088 三人行(20 分) 子曰:“三人行,必有我师焉。择其善者而从之,其不善者而改之。” 本题给定甲、乙、丙三个人的能力值关系为:甲的能力值确定是 2 位正整数;把甲的能力值的 2 个数字调换位置就是乙的能力值;甲乙两人能力差是丙的能力值的 X 倍;乙的能力值是丙的 Y 倍。请你指出谁比你强应“从之”,谁比你弱应“改之”。 输入格式: 输入在一行中给出三个数,依次为...

2018-09-09 17:04:04 592

空空如也

空空如也

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

TA关注的人

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