随笔分类 -  PAT(甲级)

摘要:Given any permutation of the numbers {0, 1, 2,..., N 1}, it is easy to sort them in increasing order. But what if Swap(0, ) is the ONLY operation that 阅读全文
posted @ 2018-01-28 15:53 A-Little-Nut 阅读(235) 评论(0) 推荐(0)
摘要:An AVL tree is a self balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any 阅读全文
posted @ 2018-01-28 12:09 A-Little-Nut 阅读(128) 评论(0) 推荐(0)
摘要:Given three integers A, B and C in [ 263, 263], you are supposed to tell whether A+B C. Input Specification: The first line of the input gives the pos 阅读全文
posted @ 2018-01-28 10:12 A-Little-Nut 阅读(176) 评论(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 node 阅读全文
posted @ 2018-01-27 16:47 A-Little-Nut 阅读(130) 评论(0) 推荐(0)
摘要:Given two sets of integers, the similarity of the sets is defined to be Nc/Nt 100%, where Nc is the number of distinct common numbers shared by the tw 阅读全文
posted @ 2018-01-27 15:35 A-Little-Nut 阅读(184) 评论(0) 推荐(0)
摘要:About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people's talent and virtue. According to his theor 阅读全文
posted @ 2018-01-27 14:55 A-Little-Nut 阅读(149) 评论(0) 推荐(0)
摘要:Sherlock Holmes received a note with some strange strings: "Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm". It took him only a min 阅读全文
posted @ 2018-01-27 14:36 A-Little-Nut 阅读(148) 评论(0) 推荐(0)
摘要:If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123 105 with 阅读全文
posted @ 2018-01-27 11:43 A-Little-Nut 阅读(218) 评论(0) 推荐(0)
摘要:Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1 p2^k2 … pm^km. Input Specifica 阅读全文
posted @ 2018-01-27 11:38 A-Little-Nut 阅读(140) 评论(0) 推荐(0)
摘要:If you are a fan of Harry Potter, you would know the world of magic has its own currency system as Hagrid explained it to Harry, "Seventeen silver Sic 阅读全文
posted @ 2018-01-27 09:07 A-Little-Nut 阅读(124) 评论(0) 推荐(0)
摘要:Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push ( 阅读全文
posted @ 2018-01-24 15:31 A-Little-Nut 阅读(295) 评论(0) 推荐(0)
摘要:Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given 阅读全文
posted @ 2018-01-24 10:48 A-Little-Nut 阅读(202) 评论(0) 推荐(0)
摘要:Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world's wealthiest people. Now you are supposed to si 阅读全文
posted @ 2018-01-23 17:14 A-Little-Nut 阅读(140) 评论(0) 推荐(0)
摘要:Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color 阅读全文
posted @ 2018-01-23 15:39 A-Little-Nut 阅读(169) 评论(0) 推荐(0)
摘要:Given a non empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the 阅读全文
posted @ 2018-01-23 11:52 A-Little-Nut 阅读(184) 评论(0) 推荐(0)
摘要:A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key 阅读全文
posted @ 2018-01-23 09:40 A-Little-Nut 阅读(139) 评论(0) 推荐(0)
摘要:Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given s 阅读全文
posted @ 2018-01-22 20:08 A-Little-Nut 阅读(154) 评论(0) 推荐(0)
摘要:Given two strings S1 and S2, S = S1 S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to cal 阅读全文
posted @ 2018-01-22 19:26 A-Little-Nut 阅读(130) 评论(0) 推荐(0)
摘要:The task is simple: given any positive integer N, you are supposed to count the total number of 1's in the decimal form of the integers from 1 to N. F 阅读全文
posted @ 2018-01-22 19:12 A-Little-Nut 阅读(128) 评论(0) 推荐(0)
摘要:Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which cou 阅读全文
posted @ 2018-01-22 11:59 A-Little-Nut 阅读(116) 评论(0) 推荐(0)