随笔分类 -  PAT

摘要: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 @ 2021-02-21 21:41 XA科研 阅读(87) 评论(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 @ 2021-02-19 00:58 XA科研 阅读(46) 评论(0) 推荐(0)
摘要:After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the rank 阅读全文
posted @ 2021-02-18 23:44 XA科研 阅读(72) 评论(0) 推荐(0)
摘要:The task of this problem is simple: insert a sequence of distinct positive integers into a hash table first. Then try to find another sequence of inte 阅读全文
posted @ 2021-02-18 22:20 XA科研 阅读(64) 评论(0) 推荐(0)
摘要: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 @ 2021-02-17 23:53 XA科研 阅读(90) 评论(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 @ 2021-02-17 22:37 XA科研 阅读(73) 评论(0) 推荐(0)
摘要:Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 1673 阅读全文
posted @ 2021-02-17 22:20 XA科研 阅读(70) 评论(0) 推荐(0)
摘要:Consider a positive integer N written in standard notation with k+1 digits a​i​​ as a​k​​⋯a​1​​a​0​​ with 0 for all i and a​k​​>0. Then N is palindrom 阅读全文
posted @ 2021-02-17 21:36 XA科研 阅读(85) 评论(0) 推荐(0)
摘要:Look-and-say sequence is a sequence of integers as the following: D, D1, D111, D113, D11231, D112213111, ... where D is in [0, 9] except 1. The (n+1)s 阅读全文
posted @ 2021-02-17 20:42 XA科研 阅读(93) 评论(0) 推荐(0)
摘要:Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output t 阅读全文
posted @ 2021-02-16 23:29 XA科研 阅读(83) 评论(0) 推荐(0)
摘要:Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the 阅读全文
posted @ 2021-02-16 22:26 XA科研 阅读(83) 评论(0) 推荐(0)
摘要:A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years 阅读全文
posted @ 2021-02-16 21:42 XA科研 阅读(85) 评论(0) 推荐(0)
摘要:Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making 阅读全文
posted @ 2021-02-09 23:01 XA科研 阅读(90) 评论(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 @ 2021-02-08 23:25 XA科研 阅读(62) 评论(0) 推荐(0)
摘要:Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid "ins 阅读全文
posted @ 2021-02-08 20:45 XA科研 阅读(125) 评论(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 @ 2021-02-07 00:02 XA科研 阅读(45) 评论(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 @ 2021-02-06 22:33 XA科研 阅读(90) 评论(0) 推荐(0)
摘要:Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a numbe 阅读全文
posted @ 2021-02-04 23:47 XA科研 阅读(98) 评论(0) 推荐(0)
摘要:To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same s 阅读全文
posted @ 2021-02-04 21:22 XA科研 阅读(57) 评论(0) 推荐(0)
摘要:To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords 阅读全文
posted @ 2021-02-02 23:48 XA科研 阅读(72) 评论(0) 推荐(0)