自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(146)
  • 收藏
  • 关注

原创 1117 Eddington Number(25 分)

British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number", E -- that is, the maximum integer E such that it is for E ...

2018-09-06 02:36:03 254

原创 1116 Come on! Let's C(20 分)

"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is for fun, the award rules are funny as...

2018-09-06 01:52:23 270

原创 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 ...

2018-09-05 20:52:32 188

原创 1121 Damn Single(25 分)

"Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can be taken care of.Input Specification:Each inpu...

2018-09-05 19:33:40 175

原创 1120 Friend Numbers(20 分)

Two integers are called "friend numbers" if they share the same sum of their digits, and the sum is their "friend ID". For example, 123 and 51 are friend numbers since 1+2+3 = 5+1 = 6, and 6 is their ...

2018-09-05 18:32:02 132

原创 1127 ZigZagging on a Tree(30 分)

Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal sequences. And it is a simple stand...

2018-09-05 05:16:39 256

原创 1126 Eulerian Path(25 分)

#include<cstdio>#include<fstream>#include<vector>using namespace std;const int maxn=510;vector<int> v[maxn];bool index[maxn]={false};int cnt=0;void dfs(int x){ inde...

2018-09-05 03:12:19 130

原创 1129 Recommendation System(25 分)

Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that rates the user's preference by the number of time...

2018-09-02 00:51:08 397

原创 1128 N Queens Puzzle(20 分)

The "eight queens puzzle" is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other. Thus, a solution requires that no two queens share the same row, ...

2018-09-01 21:08:08 143

原创 1134 Vertex Cover(25 分)

Each input file contains one test case. For each case, the first line gives two positive integers N and M (both no more than 10​4​​), being the total numbers of vertices and the edges, respectively. T...

2018-08-31 22:53:57 171

原创 1133 Splitting A Linked List(25 分)

Given a singly linked list, you are supposed to rearrange its elements so that all the negative values appear before all of the non-negatives, and all the values in [0, K] appear before all those grea...

2018-08-31 20:52:02 157

原创 1132 Cut Integer(20 分)

Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 167334, we have A = 167 and B = 334. It is interesting...

2018-08-31 00:59:31 140

原创 1138 Postorder Traversal(25 分)

Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to output the first number of the postorder traversal se...

2018-08-30 17:00:08 231

原创 1137 Final Grading(25 分)

For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first obtain no less than 200 points from...

2018-08-30 05:37:23 202

原创 1136 A Delayed Palindrome(20 分)

Consider a positive integer N written in standard notation with k+1 digits a​i​​ as a​k​​⋯a​1​​a​0​​ with 0≤a​i​​<10 for all i and a​k​​>0. Then N is palindromic if and only if a​i​​=a​k−i​​ for...

2018-08-30 04:03:29 142

原创 1143 Lowest Common Ancestor(30 分)

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.A binary search tree (BST) is recursively defined as a binary tree which has ...

2018-08-30 02:49:06 167

原创 1142 Maximal Clique(25 分)

A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A maximal clique is a clique that cannot be extended by including one more adj...

2018-08-28 21:07:01 133

原创 1141 PAT Ranking of Institutions(25 分)

After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the ranklist.Input Specification:Each input file conta...

2018-08-28 19:17:20 132

原创 1140 Look-and-say Sequence(20 分)

Look-and-say sequence is a sequence of integers as the following:D, D1, D111, D113, D11231, D112213111, ...where D is in [0, 9] except 1. The (n+1)st number is a kind of description of the nth n...

2018-08-28 17:41:10 183

原创 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...

2018-08-22 21:18:55 183

原创 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...

2018-08-22 21:07:59 167

原创 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...

2018-08-19 17:15:03 150

原创 1030 Travel Plan (30)

A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path b...

2018-08-17 17:42:13 168

原创 1003 Emergency (25)

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...

2018-08-17 16:11:50 114

原创 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...

2018-08-16 17:00:33 104

原创 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. When a ...

2018-08-16 15:57:32 151

原创 1034 Head of a Gang (30)

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 related. The weight of a relation is defined to be t...

2018-08-16 15:09:34 108

原创 1098 Insertion or Heap Sort (25)

According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. At each iteration, insertion sort removes one element from the input da...

2018-08-15 15:27:31 118

原创 1107 Social Clusters(30 分)

When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A social cluster is a set of people who have some of thei...

2018-08-14 16:30:16 207

原创 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, rebalancing is...

2018-08-14 14:57:26 95

原创 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...

2018-08-13 15:55:06 336 1

原创 1099 Build A 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...

2018-08-13 15:53:43 133

原创 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 right su...

2018-08-13 14:48:08 106

原创 1004 Counting Leaves (30)

 A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.InputEach input file contains one test case. Each case starts with a line...

2018-08-13 13:42:58 252

原创 1106 Lowest Price in Supply Chain

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...

2018-08-12 15:03:20 94

原创 1094 The Largest Generation (25)

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 ...

2018-08-11 18:07:27 109

原创 1090 Highest Price in Supply Chain (25)

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...

2018-08-11 17:39:29 107

原创 1079 Total Sales of Supply Chain (25)

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...

2018-08-11 17:14:34 154

原创 1053 Path of Equal Weight (30)

Given a non-empty tree with root R, and with weight W~i~ assigned to each tree node T~i~. 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 from ...

2018-08-11 16:10:19 98

原创 1102 Invert a Binary Tree(25 分)

The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a whiteboard so fuck off.Now it's your turn to...

2018-08-10 17:21:01 154

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除