
甲级
小火汁猛猛
为中华之崛起而读书!自然语言处理硕士在读,未来的延毕er,曾经的暴雪粉,现主机玩家,文学爱好者,YOUNG OG,09年开始玩说唱。
展开
-
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 data,...原创 2019-02-22 11:57:05 · 334 阅读 · 0 评论 -
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...原创 2019-02-17 23:20:31 · 149 阅读 · 0 评论 -
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...原创 2019-02-17 23:28:13 · 151 阅读 · 0 评论 -
1063 Set Similarity (25 分)(集合set,STL的使用)
Given two sets of integers, the similarity of the sets is defined to be Nc/Nt×100%, where Ncis the number of distinct common numbers shared by the two sets, and Ntis the total number o...原创 2019-02-17 23:47:53 · 164 阅读 · 0 评论 -
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 right su...原创 2019-02-18 01:02:04 · 113 阅读 · 0 评论 -
1130 Infix Expression (25 分)(dfs,数的遍历,中序)
Given a syntax tree (binary), you are supposed to output the corresponding infix expression, with parentheses reflecting the precedences of the operators.Input Specification:Each input file contai...原创 2019-02-27 17:17:10 · 173 阅读 · 0 评论 -
1043 Is It a Binary Search Tree (25 分)(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 su...原创 2019-02-12 16:03:58 · 130 阅读 · 0 评论 -
1126 Eulerian Path (25 分)(dfs,连通图)
In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similarly, an Eulerian circuit is an Eulerian path which starts and ends on the same vertex. They were firs...原创 2019-02-27 19:24:06 · 168 阅读 · 0 评论 -
1122 Hamiltonian Cycle (25 分)(图论)
The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a "Hamiltonian cycle".In this problem, you are supposed to tell if a given cycle ...原创 2019-02-27 20:42:00 · 334 阅读 · 1 评论 -
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.Input Specification:The first line of the input gives the positive number of test cases, T (≤...原创 2019-02-18 16:51:00 · 139 阅读 · 0 评论 -
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×105with simple chopping. Now given the number of signif...原创 2019-02-17 22:59:39 · 222 阅读 · 0 评论 -
1134 Vertex Cover (25 分)(hash散列)
A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least one vertex of the set. Now given a graph with several vertex sets, you are supposed to tell if e...原创 2019-02-27 16:32:53 · 207 阅读 · 0 评论 -
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 = p1k1×p2k2×…×pmkm.Input Specification:Each input file conta...原创 2019-02-17 18:12:10 · 173 阅读 · 0 评论 -
1090 Highest Price in Supply Chain (25 分)(树的遍历,dfs)
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 th...原创 2019-02-22 12:23:06 · 182 阅读 · 0 评论 -
1091 Acute Stroke (30 分)(BFS)
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...原创 2019-02-22 12:43:22 · 241 阅读 · 0 评论 -
1092 To Buy or Not to Buy (20 分)(Hash散列)
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...原创 2019-02-22 12:47:47 · 140 阅读 · 0 评论 -
1093 Count PAT's (25 分)(逻辑题,水题)
The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and the 6th characters.Now ...原创 2019-02-22 13:02:03 · 298 阅读 · 0 评论 -
1094 The Largest Generation (25 分)(树的遍历,BFS,DFS)
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.Input ...原创 2019-02-22 14:04:58 · 154 阅读 · 0 评论 -
1053 Path of Equal Weight (30 分)(树的遍历)
Given a non-empty tree with root R, and with weight Wiassigned 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 fr...原创 2019-02-17 09:33:25 · 110 阅读 · 0 评论 -
1054 The Dominant Color (20 分)(STL,map的使用)
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 the d...原创 2019-02-17 09:46:45 · 132 阅读 · 0 评论 -
1055 The World's Richest (25 分)(排序,strcmp)
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 peopl...原创 2019-02-17 14:56:43 · 111 阅读 · 0 评论 -
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 a Si...原创 2019-02-17 15:32:40 · 152 阅读 · 0 评论 -
1067 Sort with Swap(0, i) (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, 0, 2...原创 2019-02-19 08:38:42 · 124 阅读 · 0 评论 -
1069 The Black Hole of Numbers (20 分)(cmp函数,insert,字符串处理)
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...原创 2019-02-19 08:50:16 · 296 阅读 · 0 评论 -
1077 Kuchiguse (20 分)(字符串,getchar)
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 ...原创 2019-02-20 20:37:35 · 209 阅读 · 0 评论 -
1079 Total Sales of Supply Chain (25 分)(DFS,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 th...原创 2019-02-20 22:50:38 · 204 阅读 · 0 评论 -
1080 Graduate Admission (30 分)(排序,set)
It is said that in 2011, there are 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 admission...原创 2019-02-21 00:17:03 · 208 阅读 · 0 评论 -
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 positive int...原创 2019-02-21 00:40:07 · 178 阅读 · 0 评论 -
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 ...原创 2019-02-21 00:53:55 · 166 阅读 · 0 评论 -
1084 Broken Keyboard (20 分)(Hash散列,字符串)
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 to...原创 2019-02-21 01:17:02 · 138 阅读 · 0 评论 -
1085 Perfect Sequence (25 分)(二分法)
Given a sequence of positive integers and another positive integer p. The sequence is said to be a perfect sequence if M≤m×p where M and m are the maximum and minimum numbers in the sequence, respecti...原创 2019-02-21 01:42:20 · 320 阅读 · 0 评论 -
1086 Tree Traversals Again (25 分)(树的遍历,前中序转后序)
An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stac...原创 2019-02-21 02:14:34 · 157 阅读 · 0 评论 -
1147 Heaps (30 分)(层序转后序,堆,树的遍历)
In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either greater than or equal to (i...原创 2019-02-26 18:13:41 · 167 阅读 · 0 评论 -
1146 Topological Order (25 分)(拓扑排序)
This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed graph? Now you are supposed to write a program to test...原创 2019-02-25 21:09:06 · 148 阅读 · 0 评论 -
1145 Hashing - Average Search Time (25 分)(哈希散列,平方探测法)
The task of this problem is simple: insert a sequence of distinct positive integers into a hash table first. Then try to find another sequence of integer keys from the table and output the average sea...原创 2019-02-25 20:31:50 · 236 阅读 · 0 评论 -
1151 LCA in a Binary Tree (30 分)(数的遍历,LCA算法)
The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.Given any two nodes in a binary tree, you are supposed to find their LCA.In...原创 2019-02-25 20:00:44 · 246 阅读 · 0 评论 -
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 ...原创 2019-02-19 09:13:56 · 191 阅读 · 0 评论 -
1071 Speech Patterns (25 分)(map,STL)
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...原创 2019-02-19 09:37:54 · 107 阅读 · 0 评论 -
1114 Family Property (25 分)(并查集模板)
This time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and the estate(房产)info under his/her own name, we need to know the size of each f...原创 2019-02-28 16:09:02 · 244 阅读 · 0 评论 -
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...原创 2019-02-19 17:42:04 · 185 阅读 · 0 评论