韩江雪de 小屋

追赶时间的步伐,让每一天都在键盘上起舞!

PAT甲【所有题目+解析+代码示例+总结】附带所有历年整体+讲解+代码

PAT (Advanced Level) Practice 题目 总结 1001 A+B Format 总结 1002 1002 A+B for Polynomials (25 分) 总结 1003 总结 1004 总结 1005 Spell It Right (2...

2019-03-16 22:34:54

阅读数 45

评论数 0

1081 Rational Sum (20 分)

GivenNrational numbers in the formnumerator/denominator, you are supposed to calculate their sum. Input Specification: Each input file contains one...

2019-05-08 21:54:00

阅读数 7

评论数 0

1049 Counting Ones (30 point(s))

The task is simple: given any positive integerN, you are supposed to count the total number of 1's in the decimal form of the integers from 1 toN. Fo...

2019-04-04 22:33:14

阅读数 2

评论数 0

1008 Elevator (20 point(s))

The highest building in our city has only one elevator. A request list is made up withNpositive numbers. The numbers denote at which floors the eleva...

2019-04-03 22:51:43

阅读数 41

评论数 0

1049 数列的片段和 (20 point(s))

给定一个正数数列,我们可以从中截取任意的连续的几个数,称为片段。例如,给定数列 { 0.1, 0.2, 0.3, 0.4 },我们有 (0.1) (0.1, 0.2) (0.1, 0.2, 0.3) (0.1, 0.2, 0.3, 0.4) (0.2) (0.2, 0.3) (0.2, 0.3, ...

2019-04-03 22:31:14

阅读数 23

评论数 0

1104 Sum of Number Segments (20 point(s))

Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence { 0.1, 0.2, 0.3, 0.4 }, w...

2019-04-03 22:30:00

阅读数 4

评论数 0

1069 The Black Hole of Numbers

For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decr...

2019-03-27 08:37:19

阅读数 5

评论数 0

1101 Quick Sort (25 point(s))

There is a classical process namedpartitionin the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the...

2019-03-12 10:46:52

阅读数 8

评论数 0

1093 Count PAT's (25 分)

The stringAPPAPTcontains twoPAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by...

2019-03-12 09:14:28

阅读数 6

评论数 0

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, 12, 13, 14 } is ...

2019-03-12 08:33:03

阅读数 5

评论数 0

1089 Insert or Merge (25 分)

According to Wikipedia: Insertion sortiterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, inser...

2019-03-11 20:54:49

阅读数 4

评论数 0

1044 Shopping in Mars (25 分)

Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making...

2019-03-10 21:04:53

阅读数 8

评论数 0

1010 Radix (25 分)

Given a pair of positive integers, for example, 6 and 110, can this equation(方程、等式) 6 = 110 be true? The answer isyes, if 6 is a decimal number and 1...

2019-03-10 15:43:26

阅读数 50

评论数 0

1085 Perfect Sequence (25 分)——3种解法(二分、two pointers)

Given a sequence of positive integers and another positive integerp. The sequence is said to be aperfect sequenceifM≤m×pwhereMandmare the maximum and...

2019-03-09 22:48:46

阅读数 12

评论数 0

1038 Recover the Smallest Number (30 分)

Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we ...

2019-03-09 11:11:43

阅读数 10

评论数 0

1067 Sort with Swap(0, i) (25 分)

Given any permutation(排列) of the numbers {0, 1, 2,...,N−1}, it is easy to sort them in increasing order. But what ifSwap(0, *)is the ONLY operation t...

2019-03-09 10:27:42

阅读数 6

评论数 0

1037 Magic Coupon (25 分)

The magic shop in Mars is offering some magic coupons(优惠卷). Each coupon has an integerNprinted on it, meaning that when you use this coupon with a pr...

2019-03-08 22:42:31

阅读数 17

评论数 0

1033 To Fill or Not to Fill (25 分)

With highways available, driving a car from Hangzhou to any other city is easy. But since the tankcapacity(油罐容量) of a car is limited, we have to find...

2019-03-08 20:33:52

阅读数 6

评论数 0

2019春季PAT题解

7-1 Sexy Primes (20 分) Sexy primes are pairs of primes of the form (p, p+6), so-named since “sex” is the Latin word for “six”. (Quoted from http://ma...

2019-03-07 22:08:10

阅读数 15

评论数 0

1048 Find Coins (25 分)

Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which co...

2019-03-02 10:27:24

阅读数 21

评论数 0

提示
确定要删除当前文章?
取消 删除
关闭
关闭