PAT 甲级 1152 Google Recruitment (20分)(简单题,直接模拟)
摘要:1152 Google Recruitment (20分) In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the picture below) for re
阅读全文
posted @
2020-07-23 22:52
蔡军帅
阅读(295)
推荐(0) 编辑
PAT 2020五一线上测试赛 7-3 垃圾分类 (20分)
摘要:7-3 垃圾分类 (20分) 据香港《南华早报》2019年7月15日文章,上海严格的垃圾分类新规令不少居民抓狂。这催生出大量帮助找出正确分类答案的App和小程序。目前仅微信上就至少有280种与垃圾处理有关的App,在苹果应用商店也达130种。支付宝表示,已有60多家独立App开发商申请为该平台提供类
阅读全文
posted @
2020-05-01 20:52
蔡军帅
阅读(458)
推荐(0) 编辑
PAT 2020五一线上测试赛 7-2 三阶幸福数 (20分)
摘要:7-2 三阶幸福数 (20分) 对一个十进制数的各位数字做一次立方和,称作一次迭代。如果一个十进制数能通过 h 次迭代得到 1,就称该数为三阶幸福数,迭代的次数 h 称为幸福度。例如 1579 经过 1 次迭代得到 1198,2 次迭代后得到 1243,3 次迭代后得到 100,最后得到 1。则 1
阅读全文
posted @
2020-05-01 20:40
蔡军帅
阅读(335)
推荐(0) 编辑
PAT 2020五一线上测试赛 7-1 Knuth洗牌法 (20分)
摘要:7-1 Knuth洗牌法 (20分) Knuth 洗牌法是生成 { 1, 2, ..., n } 的一个随机重排列的算法。与每次反复随机生成一个数字,直到获得一个不重复的新数字的算法不同,Knuth 洗牌法从原始序列 { 1, 2, ..., n } 开始,逐次洗牌。洗牌的方法是从左到右,每轮从没确
阅读全文
posted @
2020-05-01 20:38
蔡军帅
阅读(245)
推荐(0) 编辑
PAT 甲级 1108 Finding Average (20分)
摘要:1108 Finding Average (20分) The basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complicated
阅读全文
posted @
2020-02-03 23:25
蔡军帅
阅读(303)
推荐(0) 编辑
PAT 甲级 1107 Social Clusters (30分)(并查集)
摘要:1107 Social Clusters (30分) When register on a social network, you are always asked to specify your hobbies in order to find some potential friends wit
阅读全文
posted @
2020-02-02 23:55
蔡军帅
阅读(267)
推荐(0) 编辑
PAT 甲级 1106 Lowest Price in Supply Chain (25分) (bfs)
摘要:1106 Lowest Price in Supply Chain (25分) A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in mo
阅读全文
posted @
2020-01-29 23:14
蔡军帅
阅读(207)
推荐(0) 编辑
PAT 甲级 1105 Spiral Matrix (25分)(螺旋矩阵,简单模拟)
摘要:1105 Spiral Matrix (25分) This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix
阅读全文
posted @
2020-01-26 19:27
蔡军帅
阅读(306)
推荐(0) 编辑
PAT 甲级 1104 Sum of Number Segments (20分)(有坑,int *int 可能会溢出)
摘要:1104 Sum of Number Segments (20分) Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the s
阅读全文
posted @
2020-01-26 18:47
蔡军帅
阅读(327)
推荐(1) 编辑
PAT 甲级 1081 Rational Sum (20分)(多个分式相加,gcd忘了)*
摘要:1081 Rational Sum (20分) Given N rational numbers in the form numerator/denominator, you are supposed to calculate their sum. Input Specification: Each
阅读全文
posted @
2019-12-24 00:47
蔡军帅
阅读(329)
推荐(0) 编辑
PAT-2019年冬季考试-甲级 7-4 Cartesian Tree (30分)(最小堆的中序遍历求层序遍历,递归建树bfs层序)
摘要: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 t
阅读全文
posted @
2019-12-08 13:07
蔡军帅
阅读(526)
推荐(0) 编辑
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 ar
阅读全文
posted @
2019-12-08 12:57
蔡军帅
阅读(594)
推荐(0) 编辑
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 lis
阅读全文
posted @
2019-12-08 12:46
蔡军帅
阅读(366)
推荐(0) 编辑
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
阅读全文
posted @
2019-12-08 12:34
蔡军帅
阅读(804)
推荐(1) 编辑
PAT 甲级 树专题小结
摘要:1.已知两个序链表建树 先序中序建树 PAT 1086 node *buildTree(vector<int>pre,vector<int>in,int pl,int pr,int il,int ir){ if(pl>pr || il>ir) return NULL; int pos=-1; for
阅读全文
posted @
2019-12-06 15:40
蔡军帅
阅读(263)
推荐(0) 编辑
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 sequen
阅读全文
posted @
2019-12-06 15:26
蔡军帅
阅读(283)
推荐(0) 编辑
PAT 甲级 1086 Tree Traversals Again (25分)(先序中序链表建树,求后序)***重点复习
摘要:1086 Tree Traversals Again (25分) An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that wh
阅读全文
posted @
2019-12-06 14:26
蔡军帅
阅读(406)
推荐(0) 编辑
PAT 甲级 1076 Forwards on Weibo (30分)(bfs较简单)
摘要:1076 Forwards on Weibo (30分) Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other us
阅读全文
posted @
2019-12-05 19:25
蔡军帅
阅读(327)
推荐(0) 编辑
PAT 甲级 1075 PAT Judge (25分)(较简单,注意细节)
摘要:1075 PAT Judge (25分) The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to g
阅读全文
posted @
2019-12-05 18:29
蔡军帅
阅读(668)
推荐(0) 编辑
PAT 甲级 1080 Graduate Admission (30 分) (简单,结构体排序模拟)
摘要:1080 Graduate Admission (30 分) It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Pro
阅读全文
posted @
2019-12-04 15:20
蔡军帅
阅读(290)
推荐(0) 编辑