随笔分类 - PAT(A level)
浙大PAT 甲级题目解答,持续更新。
摘要:屎一样的代码、、、、做完这个题就不想考试了、、、时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output "Fu" f...
阅读全文
摘要:Given N rational numbers in the form "numerator/denominator", you are supposed to calculate their sum.Input Specification:Each input file contains one test case. Each case starts with a positive integ...
阅读全文
摘要:It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the admissio...
阅读全文
摘要:A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on the ...
阅读全文
摘要:挺坑的,现百度的二次探测法。The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is defined to be "...
阅读全文
摘要:The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is called ...
阅读全文
摘要: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.Input Specification:Each input file contai...
阅读全文
摘要:输入需要稍作变换,变为一个每个人和他的关注者的map 而不是他和他的关注人、然后bfs搜索。注意搜索层数的要求。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 so...
阅读全文
摘要:reverse 方法很好用时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven 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...
阅读全文
摘要: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 the in...
阅读全文
摘要:map的使用时间限制300 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者HOU, QimingPeople often have a preference among synonyms of the same word. For example, some may prefer "the police", while others may prefer "th...
阅读全文
摘要:dij适合计算单源最短路径,计算一个源到各个点的距离比较快dfs不适合算每个点到每个点的距离,迭代次数太多、时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA gas station has to be built at such a location that the minimum distance between the s...
阅读全文
摘要:(库存量也是double)时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueMooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be...
阅读全文
摘要: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 takin...
阅读全文
摘要: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, 0, 2...
阅读全文
摘要:动态背包题意:给定一系列的硬币值, 然后给定一个目标value, 从所有硬币中找出几个, 使得这几个硬币的和正好等于这个value, 而且这个硬币序列应该是满足硬币值字典序的最小序列.分析:属于典型的背包问题. 用动态规划(dp)做, 假设F(N, M)表示不超过面值M, 而且从前面N个硬币中挑选硬币值能得到的最大硬币面值总和, 那我们可以得到如下递归公式:F(N, M) = max{ F(N–...
阅读全文
摘要:时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueAn 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; i...
阅读全文
摘要:要输入字符串,longlongint不够时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者HOU, QimingGiven three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C.Input Specification:The first l...
阅读全文
摘要:根据中序遍历建立完全二叉树。时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node...
阅读全文
摘要: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 distinct num...
阅读全文
浙公网安备 33010602011771号