随笔分类 -  pat

problems from pat
摘要: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 @ 2018-06-27 09:11 赖兴宇 阅读(139) 评论(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 Earch is called "jan, feb, mar, apr, m 阅读全文
posted @ 2018-06-27 08:36 赖兴宇 阅读(126) 评论(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 @ 2018-06-26 23:13 赖兴宇 阅读(158) 评论(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 @ 2018-06-26 22:16 赖兴宇 阅读(242) 评论(0) 推荐(0)
摘要:People often have a preference among synonyms of the same word. For example, some may prefer "the police", while others may prefer "the cops". Analyzi 阅读全文
posted @ 2018-06-26 21:21 赖兴宇 阅读(139) 评论(0) 推荐(0)
摘要:The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the s 阅读全文
posted @ 2018-06-26 18:15 赖兴宇 阅读(163) 评论(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 @ 2018-06-26 15:58 赖兴宇 阅读(133) 评论(0) 推荐(0)
摘要:1053 Path of Equal Weight (30)(30 分) Given a non-empty tree with root R, and with weight W~i~ assigned to each tree node T~i~. The weight of a path fr 阅读全文
posted @ 2018-06-26 14:36 赖兴宇 阅读(129) 评论(0) 推荐(0)
摘要:Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p~1~\^k~1~ * p~2~\^k~2~ *…*p~m~\^k~m 阅读全文
posted @ 2018-06-25 19:42 赖兴宇 阅读(668) 评论(0) 推荐(0)
摘要:给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。 输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过80的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用1个空格分开,输入保证句子末尾没有多余的空格。 输出格式:每个测试用例的 阅读全文
posted @ 2018-06-24 23:39 赖兴宇 阅读(147) 评论(0) 推荐(0)
摘要:1096 Consecutive Factors (20)(20 分) Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can b 阅读全文
posted @ 2018-06-23 15:36 赖兴宇 阅读(503) 评论(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-06-23 14:45 赖兴宇 阅读(153) 评论(0) 推荐(0)
摘要:Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given "Is PAT&TAP symmetric?", the longest sym 阅读全文
posted @ 2018-06-23 13:11 赖兴宇 阅读(101) 评论(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-06-23 12:44 赖兴宇 阅读(162) 评论(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-06-22 20:36 赖兴宇 阅读(121) 评论(0) 推荐(0)
摘要:The "eight queens puzzle" is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other. Thus, a solutio 阅读全文
posted @ 2018-06-22 20:22 赖兴宇 阅读(177) 评论(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 @ 2018-06-22 16:51 赖兴宇 阅读(148) 评论(0) 推荐(0)
摘要:Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and ino 阅读全文
posted @ 2018-06-22 16:33 赖兴宇 阅读(281) 评论(0) 推荐(0)
摘要:Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains 阅读全文
posted @ 2018-06-14 18:25 赖兴宇 阅读(720) 评论(0) 推荐(0)
摘要:Zhejiang University has 6 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 @ 2018-06-14 16:54 赖兴宇 阅读(341) 评论(0) 推荐(0)