随笔分类 - PAT
摘要:⛵️PAT总复习 这篇文章是关于一个PAT的总复习,整理以备复习参考。可能包含不全,我列出了一些易错点 🏖1.多项式 甲级1002.A+B for Polynomials题,多项式中,个人认为,多项式用最快的方法就是map进行存储,然后进行依次打印。(1009.Product of Polyn
阅读全文
摘要: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; th
阅读全文
摘要:7-50 畅通工程之局部最小花费问题 (35分) 某地区经过对城镇交通状况的调查,得到现有城镇间快速道路的统计数据,并提出“畅通工程”的目标:使整个地区任何两个城镇间都可以实现快速交通(但不一定有直接的快速道路相连,只要互相间接通过快速路可达即可)。现得到城镇道路统计表,表中列出了任意两城镇间修建快
阅读全文
摘要:7-51 两个有序链表序列的合并 (20分) 已知两个非降序链表序列S1与S2,设计函数构造出S1与S2合并后的新的非降序链表S3。 输入格式: 输入分两行,分别在每行给出由若干个正整数构成的非降序序列,用−1表示序列的结尾(−1不属于这个序列)。数字用空格间隔。 输出格式: 在一行中输出合并后新的
阅读全文
摘要:7-52 两个有序链表序列的交集 (20分) 已知两个非降序链表序列S1与S2,设计函数构造出S1与S2的交集新链表S3。 输入格式: 输入分两行,分别在每行给出由若干个正整数构成的非降序序列,用−1表示序列的结尾(−1不属于这个序列)。数字用空格间隔。 输出格式: 在一行中输出两个输入序列的交集序
阅读全文
摘要:已知有两个等长的非降序序列S1, S2, 设计函数求S1与S2并集的中位数。有序序列A0,A1,⋯,A**N−1的中位数指A(N−1)/2的值,即第⌊(N+1)/2⌋个数(A0为第1个数)。 输入格式: 输入分三行。第一行给出序列的公共长度N(0<N≤100000),随后每行输入一个序列的信息,即N
阅读全文
摘要:Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of b
阅读全文
摘要:The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed
阅读全文
摘要:A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find t
阅读全文
摘要:Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the g
阅读全文
摘要:Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3×5×6×7, where 5, 6, a
阅读全文
摘要:Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each va
阅读全文
摘要:According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert
阅读全文
摘要: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
阅读全文
摘要:People on Mars count their numbers with base 13: Zero on Earth is called "tret" on Mars. The numbers 1 to 12 on Earth is called "jan, feb, mar, apr, m
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文