- 博客(57)
- 资源 (1)
- 收藏
- 关注
原创 【PAT】1076. Forwards on Weibo (30)【宽度优先搜索】
题目描述Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. W...
2018-04-30 19:14:42 189
原创 【PAT】1075. PAT Judge (25)【结构体的使用】
题目描述The ranklist of PAT is generated from the status list, which shows the scores of the submittions. This time you are supposed to generate the ranklist for PAT.翻译:PAT的排名是根据显示提交的得分情况的状态表进行排名的,这一次...
2018-04-30 17:26:37 116
原创 【PAT】1074. Reversing Linked List (25)【链表的使用】
题目描述Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K = 3, then you must output 3→2→1→6→5→4;...
2018-04-29 13:52:38 132
原创 【PAT】1073. Scientific Notation (20)【字符串处理】
题目描述Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+-][1-9]”.”[0-9]+E[+-][0-9]+ which means that ...
2018-04-29 12:53:40 175
原创 【PAT】1072. Gas Station (30)【dijkstra算法】
题目描述A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must guarantee that all t...
2018-04-28 21:36:24 206
原创 【PAT】1071. Speech Patterns (25)【map容器的使用】
题目描述People often have a preference among synonyms of the same word. For example, some may prefer “the police”, while others may prefer “the cops”. Analyzing such patterns can help to narrow down a s...
2018-04-28 16:59:05 155
原创 【PAT】1070. Mooncake (25)【贪心算法】
题目描述Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional mooncakes according to the region’s culture...
2018-04-27 18:36:48 148
原创 【PAT】1069. The Black Hole of Numbers (20)
题目描述For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order, a new number can be obtained by...
2018-04-27 15:43:36 171
原创 【PAT】1068. Find More Coins (30)【0/1背包问题】
题目描述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 could accept all kinds of coins as payments. Ho...
2018-04-26 22:48:57 239
原创 【PAT】1067. Sort with Swap(0,*) (25)
题目描述Given any permutation of the numbers {0, 1, 2,…, N-1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to use? For example, to sort {4, ...
2018-04-26 17:34:21 101
原创 Sublime Text 3不支持中文/[Decode error - output not utf-8]解决方案
在网上百度了一下别人解决方法,发现需要以下两步才可实现,然而大部分方法都只有第一步。第一步:打开sublime Text的安装文件夹内的Packages,找到Python.sublime-package,用解压软件打开,修改里面的文件Python.sublime-build,在其中添加 “encoding”: “cp936” { "cmd": ["C:/Pytho...
2018-04-25 17:38:46 1493
原创 【PAT】1066. Root of AVL Tree (25)【平衡二叉树的实现】
题目描述An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalanc...
2018-04-25 15:13:20 128
原创 【PAT】1065. A+B and C (64bit) (20)
题目描述Given three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C.翻译:给你桑整数A,B,C 范围在[-2^63, 2^63]之间,你需要输出A+B是否大于C。INPUT FORMATThe first line of the input gives the...
2018-04-25 14:19:18 391
原创 【PAT】1064. Complete Binary Search Tree (30)【完全二叉搜索树】
题目描述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 with keys less than the node’s key. The ri...
2018-04-24 16:18:45 150
原创 【PAT】1063. Set Similarity (25)【set容器的使用】
题目描述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 two sets, and Nt is the total number of distin...
2018-04-24 14:30:59 119
原创 【PAT】1062. Talent and Virtue (25)【排序】
题目描述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 theory, a man being outstanding in both talent an...
2018-04-23 23:34:14 110
原创 【PAT】1061. Dating (20)
题目描述Sherlock Holmes received a note with some strange strings: “Let’s date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm”. It took him only a minute to figure out that those strange...
2018-04-23 17:37:05 183
原创 【PAT】1060. Are They Equal (25)【浮点数判断】
题目描述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 simple chopping. Now given the number of sig...
2018-04-22 15:35:11 262
原创 【PAT】1059. Prime Factors (25)【素数表】
题目描述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.翻译:给你任意一个正整数N,你需要找出它的所有素数因子,并且按照N = p1^k1 * p2^k2 *…*pm...
2018-04-22 13:39:46 274
原创 【PAT】1058. A+B in Hogwarts (20)
题目描述If you are a fan of Harry Potter, you would know the world of magic has its own currency system – as Hagrid explained it to Harry, “Seventeen silver Sickles to a Galleon and twenty-nine Knuts to...
2018-04-21 23:17:01 150
原创 【PAT】1057. Stack (30)【分桶法】
题目描述Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) ...
2018-04-21 22:56:33 322
原创 【PAT】1056. Mice and Rice (25)【队列的使用】
题目描述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 map. The goal of each mouse is to eat as muc...
2018-04-20 19:08:11 204
原创 【PAT】1055. The World's Richest (25)【排序】
题目描述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 simulate this job, but concentrate only on the...
2018-04-20 15:49:43 161
原创 【PAT】1054. The Dominant Color (20)
题目描述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 with the largest proportional area is called...
2018-04-19 16:24:39 148
原创 【PAT】1053. Path of Equal Weight (30)【深度优先搜索】
题目描述Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights of all the nodes along the path fro...
2018-04-19 15:54:11 173
原创 【PAT】1052. Linked List Sorting (25)【链表的使用】
题目描述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 and a Next pointer to the next structure. No...
2018-04-18 15:56:57 106
原创 【PAT】1051. Pop Sequence (25)【栈的使用】
题目描述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 sequence of numbers is a possible pop sequence ...
2018-04-18 14:55:26 345
原创 【PAT】1050. String Subtraction (20)
题目描述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 calculate S1 - S2 for any given strings. Howe...
2018-04-18 14:19:56 138
原创 【PAT】1049. Counting Ones (30)
解题思路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. For example, given N being 12, there are five...
2018-04-17 17:26:14 129
原创 【PAT】1048.Find Coins (25)
题目描述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 could accept all kinds of coins as payments. Ho...
2018-04-17 15:22:57 141
原创 【PAT】1047. Student List for Course (25)【优先队列的使用】
题目描述Zhejiang University has 40000 students and provides 2500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses.翻译:...
2018-04-16 17:25:17 126
原创 【PAT】1046. Shortest Distance (20)
题目描述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 exits.翻译:这次的任务真的很简单:给你一条一个圆形高速公路上的N个出口,你需要说...
2018-04-16 16:54:06 142
原创 【算法】尺取法——快速求解取连续子序列问题
算法描述这个算法通过反复推进开头和结尾,可以在O(n)的线性时间内解决连续子序列问题。算法模拟比如当前pre=i,pro=j,temp=a[i]+a[j]。 1.如果temp-a[i] > M,则推进pre,pre++,temp-=a[i] 重复1直到temp-a[i] < M 2.如果temp-a[i] < M,则 i—j 为以j为终点最靠近M的值 ...
2018-04-15 21:53:02 452
原创 【PAT】1045. Favorite Color Stripe (30)【贪心算法】
题目描述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 those unwanted pieces and sewing the remaining...
2018-04-15 18:39:53 878
原创 【PAT】1044. Shopping in Mars (25)【尺取法】
题目描述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 the payment, the chain can be cut at any pos...
2018-04-15 16:51:39 499
原创 【模板算法】快速幂的实现
算法介绍假设我们要求的数为a^b,那么我们可以先得到a^(b/2),而a^(b/2)又可以通过a^(b/4)得到,从而在O(logn)时间内完成运算。 非递归的方法为:假设为2^23,将23转化为2进制(10111),即为2^16 * 2^4 * 2^2 * 2,从而得出每当b&1的结果为1时就把当前的倍数赋值给ans,每次循环a都翻倍。 注意:如果进行模除,则a(翻倍后)和ans...
2018-04-14 15:59:40 152
原创 【PAT】1043. Is It a Binary Search Tree (25)【树的遍历】
题目描述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 with keys less than the node’s key. The ri...
2018-04-14 15:00:50 205
原创 【PAT】1042. Shuffling Machine (20)
题目描述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 “inside jobs” where employees collaborate with g...
2018-04-14 11:55:50 105
原创 【PAT】1041. Be Unique (20)
题目描述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 number chosen from [1, 10^4]. The first one who b...
2018-04-13 21:04:15 126
原创 【PAT】1040. Longest Symmetric String (25)
题目描述: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 symmetric sub-string is “s PAT&TAP s”,...
2018-04-13 18:23:20 212
hibernate5.2.12+spring5.0.2+tomcat8.5.23+ant1.10.3
2018-06-06
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人