原创 PAT_1039: Course List for Student

Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses,

原创 PAT_1028: List Sorting

Excel can sort records according to any column. Now you are supposed to imitate this function. Input Each input file

原创 PAT_1054: The Dominant Color

Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for eac

原创 PAT_1030: Travel Plan

A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now y

原创 PAT_1027: Colors in Mars

People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is repre

原创 PAT_1059: Prime Factors

Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k

原创 PAT_1016: Phone Bills

A long-distance telephone company charges its customers by the following rules: Making a long-distance call costs a c

原创 PAT_1053: Path of Equal Weight

Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti.The weight of a path from R to

原创 PAT_1037: Magic Coupon

The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when

原创 PAT_1020: Tree Traversals

Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal s

原创 PAT_1029: Median

Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median

原创 PAT_1060: Are They Equal

If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they ar

原创 PAT_1051: Pop Sequence

Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You a

原创 PAT_1050: String Subtraction

Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the characters in S2 f

原创 PAT_1055: The World's Richest

Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world's wealthiest pe