随笔分类 -  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 @ 2019-09-01 09:19 自由之翼Az 阅读(213) 评论(0) 推荐(0)
摘要:The K−P factorization of a positive integer N is to write N as the sum of the P-th power of Kpositive integers. You are supposed to write a program to 阅读全文
posted @ 2019-08-30 18:21 自由之翼Az 阅读(183) 评论(0) 推荐(0)
摘要:The following is from Max Howell @twitter: Now it's your turn to prove that YOU CAN invert a binary tree! Input Specification: Each input file contain 阅读全文
posted @ 2019-08-16 20:45 自由之翼Az 阅读(186) 评论(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 @ 2019-08-16 20:04 自由之翼Az 阅读(148) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-08-16 14:05 自由之翼Az 阅读(180) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-08-16 10:39 自由之翼Az 阅读(177) 评论(0) 推荐(0)
摘要:According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert 阅读全文
posted @ 2019-08-15 11:01 自由之翼Az 阅读(214) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-08-15 10:49 自由之翼Az 阅读(190) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-08-15 10:13 自由之翼Az 阅读(186) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-08-14 14:57 自由之翼Az 阅读(257) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-08-14 10:21 自由之翼Az 阅读(171) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-08-13 23:39 自由之翼Az 阅读(254) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-08-13 22:28 自由之翼Az 阅读(165) 评论(0) 推荐(0)
摘要:One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions 阅读全文
posted @ 2019-08-13 22:08 自由之翼Az 阅读(152) 评论(0) 推荐(0)
摘要:A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer 阅读全文
posted @ 2019-08-13 11:55 自由之翼Az 阅读(164) 评论(0) 推荐(0)
摘要:According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert 阅读全文
posted @ 2019-08-13 10:59 自由之翼Az 阅读(223) 评论(0) 推荐(0)
摘要:For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient. Input Sp 阅读全文
posted @ 2019-08-12 22:08 自由之翼Az 阅读(231) 评论(0) 推荐(0)
摘要: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 gainin 阅读全文
posted @ 2019-08-12 20:59 自由之翼Az 阅读(189) 评论(0) 推荐(0)
摘要:An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the 阅读全文
posted @ 2019-08-12 09:32 自由之翼Az 阅读(170) 评论(0) 推荐(0)
摘要:Given a sequence of positive integers and another positive integer p. The sequence is said to be a perfect sequence if M≤m×p where M and m are the max 阅读全文
posted @ 2019-08-11 23:28 自由之翼Az 阅读(329) 评论(0) 推荐(0)