PAT(Advanced Level)
文章平均质量分 77
zju兔子哥哥
爱生活,爱编程
展开
-
PAT (Advanced Level) 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 significa原创 2015-07-28 10:05:00 · 488 阅读 · 0 评论 -
PAT (Advanced Level) 1080. Graduate Admission (30) 模拟高考录取,结构体排序
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原创 2015-07-30 10:18:33 · 582 阅读 · 0 评论 -
PAT (Advanced Level) 1076. Forwards on Weibo (30) 微博转发 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 social network is formed with followers relations. When a原创 2015-07-29 20:12:20 · 430 阅读 · 0 评论 -
PAT (Advanced Level) 1078. Hashing (25) 哈希,二次探测法
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 "H(key) = key %原创 2015-07-29 21:12:19 · 562 阅读 · 0 评论 -
PAT (Advanced Level) 1079. Total Sales of Supply Chain (25) 总叠加售价 BFS
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原创 2015-07-29 22:08:22 · 639 阅读 · 0 评论 -
PAT (Advanced Level) 1090. Highest Price in Supply Chain (25) 供应链,BFS
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原创 2015-07-31 09:02:10 · 929 阅读 · 0 评论 -
PAT (Advanced Level) 1087. All Roads Lead to Rome (30) 条条大路通罗马 Dijkstra+DFS
Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happiness.Input Specification:E原创 2015-07-30 20:32:40 · 975 阅读 · 0 评论 -
PAT (Advanced Level) 1081. Rational Sum (20) 分数求和,辗转相除法求gcd
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 positi原创 2015-07-30 11:04:25 · 604 阅读 · 0 评论 -
PAT (Advanced Level) 1084. Broken Keyboard (20) 坏键盘,字符串处理
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.Now given a string that you are supposed原创 2015-07-30 14:42:04 · 347 阅读 · 0 评论 -
PAT (Advanced Level) 1089. Insert or Merge (25) 插入和归并
According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input dat原创 2015-07-30 21:50:22 · 741 阅读 · 0 评论 -
PAT (Advanced Level) 1091. Acute Stroke (30) 3维DFS(10M数据时栈溢出)、3维BFS(AC)
One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions are identified in each MRI slice, your job is to c原创 2015-07-31 10:05:33 · 1107 阅读 · 0 评论 -
PAT (Advanced level) 1077. Kuchiguse (20) 最长共同后缀
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原创 2015-07-29 20:52:43 · 365 阅读 · 0 评论 -
PAT (Advanced Level) 1075. PAT Judge (25) PAT排名 结构体排序
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 fil原创 2015-07-29 19:21:44 · 647 阅读 · 0 评论 -
PAT (Advanced Level) 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 and virt原创 2015-07-28 10:59:58 · 600 阅读 · 0 评论 -
PAT (Advanced Level) 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 distinct n原创 2015-07-28 13:31:14 · 440 阅读 · 0 评论 -
PAT (Advanced Level) 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 strings are a原创 2015-07-28 10:28:27 · 469 阅读 · 0 评论 -
PAT (Advanced Level) 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 takin原创 2015-07-28 21:49:18 · 382 阅读 · 0 评论 -
PAT (Advanced Level) 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. Now原创 2015-07-29 09:24:28 · 399 阅读 · 0 评论 -
PAT (Advanced Level) 1068. Find More Coins (30) DFS+剪枝 或 动态规划
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. However,原创 2015-07-28 20:30:21 · 746 阅读 · 2 评论 -
PAT (Advanced Level) 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 the hou原创 2015-07-29 14:48:30 · 887 阅读 · 0 评论 -
PAT (Advanced Level) 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; if K原创 2015-07-29 16:23:27 · 501 阅读 · 0 评论 -
PAT (Advanced Level) 1071. Speech Patterns (25) 字符串处理
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 speaker原创 2015-07-29 10:30:51 · 479 阅读 · 0 评论 -
PAT (Advanced Level) 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 the in原创 2015-07-29 15:46:18 · 466 阅读 · 0 评论 -
PAT (Advanced Level) 1083. List Grades (25) 结构体排序
Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student records of which the grades原创 2015-07-30 14:23:30 · 400 阅读 · 0 评论 -
PAT (Advanced Level) 1003. Emergency (25) 最短路径 DFS
As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the l原创 2015-07-19 15:02:06 · 560 阅读 · 0 评论 -
PAT (Advanced Level) 1018. Public Bike Management (30) 杭州自行车 最短路径+DFS
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 any station and return it to any other stations in the原创 2015-07-21 22:45:21 · 724 阅读 · 0 评论 -
PAT (Advanced Level) 1013. Battle Over Cities (25) 并查集
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 city are closed. We must know immediately if we nee原创 2015-07-20 16:23:54 · 636 阅读 · 0 评论 -
PAT (Advenced Level) 1026. Table Tennis (30) 模拟排队,有vip
A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For any pair of players, if there are some tables open when they arrive, they will be assigned to the ava原创 2015-07-23 11:05:20 · 675 阅读 · 0 评论 -
PAT (Advanced Level) 1094. The Largest Generation (25) 人数最多的一代,BFS
A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest population.Inpu原创 2015-07-31 15:56:50 · 500 阅读 · 0 评论 -
PAT (Advanced Level) 1096. Consecutive Factors (20) 连续质因数
Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3*5*6*7, where 5, 6, and 7 are the three consecutive numbers. Now given原创 2015-07-31 21:16:23 · 1974 阅读 · 0 评论 -
PAT (Advanced Level) 1099. Build A Binary Search Tree (30) 中序遍历往BST中填数据
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 right原创 2015-08-01 14:05:41 · 760 阅读 · 0 评论 -
PAT (Advanced Level) 1017. Queueing at Bank (25) 银行排队等待时间
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 customers have to wait in line behind the yellow li原创 2015-07-21 18:49:45 · 961 阅读 · 0 评论 -
PAT (Advanced Level) 1020. Tree Traversals (25) 给定后序中序,递归建树
Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the cor原创 2015-07-22 10:37:52 · 460 阅读 · 0 评论 -
PAT (Advanced Level) 1021. Deepest Root (25) 并查集+DFS
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 root that results in a highest tree. Such a root原创 2015-07-22 14:25:16 · 497 阅读 · 0 评论 -
PAT (Advanced Level) 1033. To Fill or Not to Fill (25)最省加油方案,贪心算法
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 stations on the way from time to time. Different ga原创 2015-07-24 12:23:09 · 662 阅读 · 0 评论 -
PAT (Advanced Level) 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", hence you must原创 2015-07-25 09:42:46 · 578 阅读 · 0 评论 -
PAT (Advanced Level) 1016. Phone Bills (25) 电话账单
A long-distance telephone company charges its customers by the following rules:Making a long-distance call costs a certain amount per minute, depending on the time of day when the call is made. Wh原创 2015-07-21 10:37:02 · 1148 阅读 · 0 评论 -
PAT (Advanced Level) 1015. Reversible Primes (20) 翻转质数
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 reversible prime because its reverse 37 is also a pr原创 2015-07-20 20:54:56 · 467 阅读 · 0 评论 -
PAT (Advanced Level) 1092. To Buy or Not to Buy (20) 哈希
Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the owner of the shop would only sel原创 2015-07-31 14:56:15 · 684 阅读 · 0 评论 -
PAT (Advanced Level) 1082. Read Number in Chinese (25) 数字转汉字大写
Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output "Fu" first if it is negative. For example, -123456789 is read as "Fu yi Yi er Qian san B原创 2015-07-30 13:48:16 · 784 阅读 · 0 评论