摘要:1113 Integer Set Partition (25 分) Given a set of NNN (>1> 1>1) positive integers, you are supposed to partition them into two disjoint sets A1A_1A1
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:1092 To Buy or Not to Buy (20 分) Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. Ther
阅读全文
摘要: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
阅读全文
摘要:1155 Heap Paths (30 分) In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node
阅读全文
摘要:1032 Sharing (25 分) To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the wo
阅读全文
摘要:1032 Sharing (25 分) To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the wo
阅读全文
摘要:1031 Hello World for U (20 分) Given any string of NNN (≥5\ge 5≥5) characters, you are asked to form the characters into the shape of U. For example, h
阅读全文
摘要: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 su
阅读全文
摘要:1029 Median (25 分) Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11
阅读全文
摘要:1027 Colors in Mars (20 分) People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represente
阅读全文
摘要:1028 List Sorting (25 分) Excel can sort records according to any column. Now you are supposed to imitate this function. Input Specification: Each inpu
阅读全文
摘要:1025 PAT Ranking (25 分) Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each tes
阅读全文
摘要:1024 Palindromic Number (25 分) A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example,
阅读全文
摘要:Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 2469135
阅读全文
摘要:A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years
阅读全文
摘要:A graph which is connected and acyclic can be considered a tree. The hight of the tree depends on the selected root. Now you are supposed to find the
阅读全文
摘要:A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number
阅读全文
摘要:Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to ou
阅读全文