Feature:PAT-甲级
@kidultff

PAT-A 真题- 1032. Sharing

题干: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 words share the same sublist if they share the same suffix. For example, "loading" and "being" ...
  • 0
  • 1
@kidultff

PAT-A 真题- 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 are supposed to tell if a given sequence of numbers is a possible pop sequence of the stack. For example, ...
  • 0
  • 0
@kidultff

PAT-B 真题- 1025. 反转链表 / A 1074 Reversing Linked List

原题干:给定一个常数K以及一个单链表L,请编写程序将L中每K个结点反转。例如:给定L为1→2→3→4→5→6,K为3,则输出应该为3→2→1→6→5→4;如果K为4,则输出应该为4→3→2→1→5→6,即最后不到K个元素不反转。输入格式:每个输入包含1个测试用例。每个测试 ...
  • 0
  • 0
@kidultff

PAT-B 真题- 1030. 完美数列/A1085 Perfect Sequence

原题干:给定一个正整数数列,和正整数p,设这个数列中的最大值是M,最小值是m,如果M <= m * p,则称这个数列是完美数列。现在给定参数p和一些正整数,请你从中选择尽可能多的数构成一个完美数列。输入格式:输入第一行给出两个正整数N和p,其 ...
  • 0
  • 1
@kidultff

C语言利用sort函数快速排序(PAT真题- 1025. PAT Ranking)

sort函数是C语言中一个用于快速排序的函数,可以免于写冒泡排序,二分查找等麻烦的东西,时间复杂度为n*log2(n)。 使用sort函数排序需要先引入头文件#include <algorithm> sort函数的原型:sort(_RandomAccessIterator __firs ...
  • 0
  • 0