随笔分类 -  PTA甲级

摘要:Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be the remaining string after taking all the characters in S​2​​ from S​1​​. Your task 阅读全文
posted @ 2019-12-15 16:21 57one 阅读(86) 评论(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 @ 2019-12-15 16:10 57one 阅读(172) 评论(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 @ 2019-12-15 15:34 57one 阅读(136) 评论(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 @ 2019-12-13 21:21 57one 阅读(161) 评论(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 @ 2019-12-13 20:19 57one 阅读(266) 评论(0) 推荐(0)
摘要:Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off th 阅读全文
posted @ 2019-12-13 15:47 57one 阅读(155) 评论(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 @ 2019-12-12 20:44 57one 阅读(300) 评论(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 @ 2019-12-12 19:00 57one 阅读(184) 评论(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 @ 2019-12-11 15:37 57one 阅读(222) 评论(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 @ 2019-12-11 15:01 57one 阅读(197) 评论(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 symme 阅读全文
posted @ 2019-12-10 21:15 57one 阅读(161) 评论(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 @ 2019-12-10 18:04 57one 阅读(260) 评论(0) 推荐(0)
摘要:Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we c 阅读全文
posted @ 2019-12-10 17:25 57one 阅读(187) 评论(0) 推荐(0)
摘要: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 @ 2019-12-10 15:03 57one 阅读(228) 评论(0) 推荐(0)
摘要:1036 Boys vs Girls (25分) This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all 阅读全文
posted @ 2019-12-09 21:47 57one 阅读(206) 评论(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 @ 2019-12-09 21:32 57one 阅读(238) 评论(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 @ 2019-12-09 21:10 57one 阅读(168) 评论(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 @ 2019-12-08 19:28 57one 阅读(308) 评论(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 @ 2019-12-08 16:48 57one 阅读(224) 评论(0) 推荐(0)
摘要:Given any string of N (≥) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as: h d e l l r 阅读全文
posted @ 2019-12-08 15:56 57one 阅读(252) 评论(0) 推荐(0)