随笔分类 -  PAT

摘要: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 @ 2017-11-14 19:14 gaoren 阅读(228) 评论(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 @ 2017-11-13 19:13 gaoren 阅读(155) 评论(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 @ 2017-11-12 11:40 gaoren 阅读(150) 评论(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 @ 2017-11-11 12:37 gaoren 阅读(211) 评论(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 Specif 阅读全文
posted @ 2017-11-10 09:19 gaoren 阅读(180) 评论(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 @ 2017-11-09 11:00 gaoren 阅读(434) 评论(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 @ 2017-11-08 09:45 gaoren 阅读(149) 评论(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 @ 2017-11-07 19:36 gaoren 阅读(224) 评论(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 @ 2017-11-06 17:36 gaoren 阅读(213) 评论(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 @ 2017-11-05 09:59 gaoren 阅读(255) 评论(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 @ 2017-11-04 14:46 gaoren 阅读(141) 评论(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 @ 2017-11-03 09:46 gaoren 阅读(127) 评论(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 @ 2017-11-02 12:09 gaoren 阅读(220) 评论(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 @ 2017-11-01 10:46 gaoren 阅读(311) 评论(0) 推荐(0)
摘要:Zhejiang University has 40000 students and provides 2500 courses. Now given the registered course list of each student, you are supposed to output the 阅读全文
posted @ 2017-10-31 19:06 gaoren 阅读(191) 评论(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 c 阅读全文
posted @ 2017-10-30 19:12 gaoren 阅读(172) 评论(0) 推荐(0)
摘要:The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of e 阅读全文
posted @ 2017-10-29 09:21 gaoren 阅读(154) 评论(0) 推荐(0)
摘要:One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is re 阅读全文
posted @ 2017-10-28 20:29 gaoren 阅读(183) 评论(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 @ 2017-10-27 21:21 gaoren 阅读(180) 评论(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 @ 2017-10-27 16:46 gaoren 阅读(211) 评论(0) 推荐(0)