2018年9月的全部文章
@kidultff

PAT-A 真题 – 1151 LCA in a Binary Tree

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.Input Specification:Each input file ...
  • 0
  • 0
@kidultff

PAT-A 真题 – 1110 Complete Binary Tree

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, the first line gives a positive integer N (≤20) which is the total number ...
  • 0
  • 1
@kidultff

PAT-A 真题 – 1150 Travelling Salesman Problem

The "travelling salesman problem" asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city and returns to the ori ...
  • 0
  • 0
@kidultff

PAT-A 真题 – 1149 Dangerous Goods Packaging

When shipping goods with containers, we have to be careful not to pack some incompatible goods into the same container, or we might get ourselves in serious trouble. For example, oxidizing agent (氧化剂) must not be packed with ...
  • 0
  • 0
@kidultff

PAT-A1148/B1089 Werewolf - Simple Version 狼人杀

Werewolf(狼人杀) is a game in which the players are partitioned into two parties: the werewolves and the human beings. Suppose that in a game,player #1 said: "Player #2 is a werewolf.";player #2 said: "Player #3 ...
  • 0
  • 0