PAT(A) 1135. Is It A Red-Black Tree (30)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1135

1135. Is It A Red-Black Tree (30)


There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties:

继续阅读


PAT(A) 1134. Vertex Cover (25)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1134

1134. Vertex Cover (25)


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

继续阅读


PAT(A) 1133. Splitting A Linked List (25)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1133

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]

继续阅读


PAT(A) 1132. Cut Integer (20)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1132

1132. Cut Integer (20)


Cutting an integer means to cut a K digits long integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 167334,

继续阅读


PAT(A) 1127. ZigZagging on a Tree (30)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1127

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.

继续阅读


PAT(A) 1126. Eulerian Path (25)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1126

1126. Eulerian Path (25)


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.

继续阅读


PAT(A) 1125. Chain the Ropes (25)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1125

1125. Chain the Ropes (25)


Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fold two segments into loops and chain them into one

继续阅读


PAT(A) 1124. Raffle for Weibo Followers (20)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1124

1124. Raffle for Weibo Followers (20)


John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers on Weibo -- that is, he

继续阅读


PAT(A) 1123. Is It a Complete AVL Tree (30)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1123

1123. Is It a Complete AVL Tree (30)


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

继续阅读


PAT(A) 1122. Hamiltonian Cycle (25)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1122

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 is

继续阅读


PAT(A) 1121. Damn Single (25)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1121

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:

继续阅读


PAT(A) 1120. Friend Numbers (20)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1120

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

继续阅读


PAT(A) 1119. Pre- and Post-order Traversals (30)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1119

1119. Pre- and Post-order Traversals (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

继续阅读


PAT(A) 1118. Birds in Forest (25)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1118

1118. Birds in Forest (25)


Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belong to the same tree.

继续阅读


PAT(A) 1117. Eddington Number(25)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1117

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",

继续阅读


PAT(A) 1116. Come on! Let's C (20)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1116

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 the following:

继续阅读


PAT(A) 1111. Online Map (30)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1111

1111. Online Map (30)


Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and the other is the fastest. It is guaranteed that a path exists for

继续阅读


PAT(A) 1110. Complete Binary Tree (25)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1110

1110. Complete Binary Tree (25)


Given a tree, you are supposed to tell if it is a complete binary tree.

Input Specification:

Each input file contains one test case. For each case,

继续阅读


PAT(A) 1109. Group Photo (25)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1109

1109. Group Photo (25)


Formation is very important when taking a group photo. Given the rules of forming K rows with N people as the following:

The number of people in each row must be N/K (round down to the nearest integer),

继续阅读


PAT(A) 1064. Complete Binary Search Tree (30)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1064

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

继续阅读


1063. Set Similarity (25)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1063

1063. Set Similarity (25)


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,

继续阅读


PAT(A) 1062. Talent and Virtue (25)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1062

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

继续阅读


Pat(A) 1061. Dating (20)

原题目:

原题链接:https://www.patest.cn/contests/pat-a-practise/1061

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

继续阅读


Powered by Django 2. Copyright © 2014.

huchengbei.com. All rights reserved.