随笔分类 -  PAT

摘要:The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a produc 阅读全文
posted @ 2020-03-12 19:24 阳离子 阅读(156) 评论(0) 推荐(0)
摘要:With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas s 阅读全文
posted @ 2020-03-12 11:18 阳离子 阅读(166) 评论(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 r 阅读全文
posted @ 2020-03-11 22:52 阳离子 阅读(142) 评论(0) 推荐(0)
摘要:A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a progra 阅读全文
posted @ 2020-03-09 11:06 阳离子 阅读(194) 评论(0) 推荐(0)
摘要:Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 1 阅读全文
posted @ 2020-03-08 22:55 阳离子 阅读(142) 评论(0) 推荐(0)
摘要:include include include include include include include include include include include include include using namespace std; struct node{ string id, n 阅读全文
posted @ 2020-03-08 21:59 阳离子 阅读(69) 评论(0) 推荐(0)
摘要:Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run sim 阅读全文
posted @ 2020-03-05 19:38 阳离子 阅读(111) 评论(0) 推荐(0)
摘要:A number that will be the same when it is written forwards or backwards is known as a Palindromic Number . For example, 1234321 is a palindromic numbe 阅读全文
posted @ 2020-03-05 17:26 阳离子 阅读(165) 评论(0) 推荐(0)
摘要:A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the 阅读全文
posted @ 2020-03-04 17:55 阳离子 阅读(119) 评论(0) 推荐(0)
摘要:Notice that the number 123456789 is a 9 digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 2469135 阅读全文
posted @ 2020-03-03 21:29 阳离子 阅读(194) 评论(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 @ 2020-03-03 20:49 阳离子 阅读(145) 评论(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 . 阅读全文
posted @ 2020-03-01 23:31 阳离子 阅读(143) 评论(0) 推荐(0)
摘要:题意 There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at an 阅读全文
posted @ 2020-02-29 22:49 阳离子 阅读(130) 评论(0) 推荐(0)
摘要:Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the c 阅读全文
posted @ 2020-02-27 10:35 阳离子 阅读(131) 评论(0) 推荐(0)
摘要:Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules 阅读全文
posted @ 2020-02-26 18:16 阳离子 阅读(108) 评论(0) 推荐(0)
摘要:A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a re 阅读全文
posted @ 2020-02-22 23:19 阳离子 阅读(193) 评论(0) 推荐(0)
摘要:To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C Programming Language, Mathematics 阅读全文
posted @ 2020-02-22 22:43 阳离子 阅读(110) 评论(0) 推荐(0)
摘要:It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that c 阅读全文
posted @ 2020-02-22 22:39 阳离子 阅读(110) 评论(0) 推荐(0)
摘要:Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is , if 6 is a decimal number and 110 is a bi 阅读全文
posted @ 2020-02-20 12:48 阳离子 阅读(140) 评论(0) 推荐(0)
摘要:Given a sequence of K integers { N 1, N 2, ..., N K }. A continuous subsequence is defined to be { N i , N i +1, ..., N j } where 1≤ i ≤ j ≤ K . The M 阅读全文
posted @ 2020-02-16 22:21 阳离子 阅读(207) 评论(0) 推荐(0)