随笔分类 -  pat

pat刷题
摘要:Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence { 0.1, 0.2, 0.3, 0.4 }, we 阅读全文
posted @ 2022-11-19 02:15 zzzlight 阅读(6) 评论(0) 推荐(0) 编辑
摘要:A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer 阅读全文
posted @ 2022-11-19 02:14 zzzlight 阅读(19) 评论(0) 推荐(0) 编辑
摘要:This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in from the fi 阅读全文
posted @ 2022-11-19 02:13 zzzlight 阅读(17) 评论(0) 推荐(0) 编辑
摘要:The K−P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a program t 阅读全文
posted @ 2022-11-19 02:06 zzzlight 阅读(23) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2022-11-19 02:06 zzzlight 阅读(16) 评论(0) 推荐(0) 编辑
摘要:There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then th 阅读全文
posted @ 2022-11-19 02:02 zzzlight 阅读(20) 评论(0) 推荐(0) 编辑
摘要:The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants. Given any two nodes in a bin 阅读全文
posted @ 2020-03-21 21:51 zzzlight 阅读(129) 评论(0) 推荐(0) 编辑
摘要:题干前半略。 Sample Input 1: 8 98 72 86 60 65 12 23 50 Sample Output 1: 98 86 23 98 86 12 98 72 65 98 72 60 50 Max Heap Sample Input 2: 8 8 38 25 58 52 82 7 阅读全文
posted @ 2020-03-21 21:47 zzzlight 阅读(142) 评论(0) 推荐(0) 编辑
摘要:题目前半略 Sample Input: 10 11 8 7 6 8 4 5 8 4 8 1 1 2 1 4 9 8 9 1 1 0 2 4 4 0 1 0 1 4 1 0 1 3 0 0 1 0 1 4 1 0 1 0 0 8 1 0 1 4 1 0 5 3 0 1 2 3 4 5 6 7 8 8 阅读全文
posted @ 2020-03-21 21:45 zzzlight 阅读(158) 评论(0) 推荐(0) 编辑
摘要:A registration card number of PAT consists of 4 parts: the 1st letter represents the test level, namely, T for the top level, A for advance and B for 阅读全文
posted @ 2020-03-21 21:43 zzzlight 阅读(212) 评论(0) 推荐(0) 编辑
摘要:题干前半略。 Input Specification: Each input file contains one test case. Each case first gives in a line two positive integers: L (≤ 1,000) and K (< 10), w 阅读全文
posted @ 2020-03-21 21:40 zzzlight 阅读(204) 评论(0) 推荐(0) 编辑
摘要:The "travelling salesman problem" asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shor 阅读全文
posted @ 2020-03-21 21:38 zzzlight 阅读(140) 评论(0) 推荐(0) 编辑
摘要:Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that 阅读全文
posted @ 2020-03-21 21:37 zzzlight 阅读(143) 评论(0) 推荐(0) 编辑
摘要:此题题干略 Sample Input: 4 7 1001 3212 1003 1204 1005 1306 7797 9 9988 2333 1204 2006 2005 2004 2003 2302 2001 13 3011 3812 3013 3001 1306 3003 2333 3066 3 阅读全文
posted @ 2020-03-21 21:34 zzzlight 阅读(135) 评论(0) 推荐(0) 编辑
摘要:Sample Input: 6 6 7 01234 880 a1903 199 ydjh2 200 wehu8 300 dx86w 220 missing 400 ydhfu77 99 wehu8 55 ydjh2 98 dx86w 88 a1903 86 01234 39 ydhfu77 88 a 阅读全文
posted @ 2020-03-21 21:29 zzzlight 阅读(152) 评论(0) 推荐(0) 编辑
摘要:Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years. When a boy A had a crush on a g 阅读全文
posted @ 2020-03-21 21:27 zzzlight 阅读(163) 评论(0) 推荐(0) 编辑
摘要:British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number", E -- tha 阅读全文
posted @ 2020-03-21 21:25 zzzlight 阅读(135) 评论(0) 推荐(0) 编辑
摘要:The basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complicated is that some of the input n 阅读全文
posted @ 2020-03-21 21:24 zzzlight 阅读(112) 评论(0) 推荐(0) 编辑
摘要:Given two sets of integers, the similarity of the sets is defined to be /, where N​c​​ is the number of distinct common numbers shared by the two sets 阅读全文
posted @ 2020-03-21 21:22 zzzlight 阅读(190) 评论(0) 推荐(0) 编辑
摘要:Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to ou 阅读全文
posted @ 2020-03-21 21:17 zzzlight 阅读(153) 评论(0) 推荐(0) 编辑