Header img   

楚虽三户,亡秦必楚



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 would select winners from every N followers who forwarded his post, and give away gifts. Now you are

Read More
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 by at most one; if at any time they differ by more than one, rebalancing is done to restore this pro

Read More
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 a Hamiltonian cycle. <!--more

Read More
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:

Each input file contains one t

Read More
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 friend numbers since 1+2+3 = 5+1 = 6, and 6 is their friend ID. Given some numbers, you a

Read More
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 postorder and inorder traversal sequences, or preorder and inorder traversal sequences.

Read More
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. You are supposed to help the scientists to count the maximum number of trees in the forest,

Read More
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", E -- that is, the maximum integer E such that it is for E days that one rides more than E mi

Read More
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:

  1. The Champion
Read More
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 any req

Read More