The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times the value of that product back! What is more, the shop also offers some bonus product for free. However, if you

Continue reading PAT1037 Magic Coupon (25)

# Tag: PAT

## PAT 1100. Mars Numbers (20)

http://www.patest.cn/contests/pat-a-practise/1100 People on Mars count their numbers with base 13: Zero on Earth is called “tret” on Mars. The numbers 1 to 12 on Earch is called “jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec” on Mars, respectively. For the next higher digit, Mars people name the 12 numbers as “tam,

Continue reading PAT 1100. Mars Numbers (20)

## PAT 1077. Kuchiguse (20)

http://www.patest.cn/contests/pat-a-practise/1077 The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker’s personality. Such a preference is called “Kuchiguse” and is often exaggerated artistically in Anime and Manga. For example, the artificial sentence ending particle “nyan~” is often used as a stereotype

Continue reading PAT 1077. Kuchiguse (20)

## PAT 1017. Queueing at Bank (25)

PATEST链接地址：http://www.patest.cn/contests/pat-a-practise/1017 Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wait in line behind the yellow line, until it is his/her turn to be served and there is a window available. It

Continue reading PAT 1017. Queueing at Bank (25)

## 1074. Reversing Linked List (25) 链表反转~最后一个测试点，小心特殊情况！

原题： Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K = 3, then you must output 3→2→1→6→5→4; if K = 4, you must output 4→3→2→1→5→6. Input Specification: Each input file contains one test

Continue reading 1074. Reversing Linked List (25) 链表反转~最后一个测试点，小心特殊情况！

## 1078. Hashing (25) ：：哈希表二次探测法|质数判定

原题http://www.patest.cn/contests/pat-a-practise/1078： The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is defined to be “H(key) = key % TSize” where TSize is the maximum size of the hash table. Quadratic probing (with positive increments only)

Continue reading 1078. Hashing (25) ：：哈希表二次探测法|质数判定

## 1065. A+B and C (64bit) (20)

http://www.patest.cn/contests/pat-a-practise/1065 原题如下 Given three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C. Input Specification: The first line of the input gives the positive number of test cases, T (<=10). Then T test cases follow, each consists of a single line containing three integers A, B

Continue reading 1065. A+B and C (64bit) (20)

## PAT 1012. The Best Rank (25)

To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C – C Programming Language, M – Mathematics (Calculus or Linear Algebra), and E – English. At the mean time, we encourage students by emphasizing on their best ranks — that is, among the four ranks

Continue reading PAT 1012. The Best Rank (25)

## 1030. Travel Plan (30)

时间限制：400ms A traveler’s map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path between his/her starting city and the destination. If such a shortest path is not unique, you are supposed to

Continue reading 1030. Travel Plan (30)

## 1054. The Dominant Color (20)

时间限制：100ms Behind the scenes in the computer’s memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called the dominant color. A strictly dominant color takes more than half of the total area. Now given an image of resolution

Continue reading 1054. The Dominant Color (20)