算法设计 - 模拟
i逆天耗子丶
这个作者很懒,什么都没留下…
展开
-
PAT - 甲级 - 1067. Sort with Swap(0,*) (25)(模拟+贪心)
Given any permutation of the numbers {0, 1, 2,..., N-1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to use? For example, to sort {4, 0, 2原创 2017-11-29 21:36:28 · 293 阅读 · 0 评论 -
PAT - 甲级 - 1017. Queueing at Bank (25)(模拟+排序)
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 li原创 2017-11-24 20:37:37 · 386 阅读 · 0 评论 -
PAT - 甲级 - 1009. Product of Polynomials (25)(模拟)
This time, you are supposed to find A*B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the inf原创 2017-11-24 22:16:40 · 349 阅读 · 0 评论 -
PAT - 甲级 - 1002. A+B for Polynomials (25)(模拟)
This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line contains the information of a p原创 2017-11-25 10:40:20 · 426 阅读 · 0 评论 -
PAT - 甲级 - 1042. Shuffling Machine (20)(模拟)
Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid "inside jobs" where employees collaborate with gambler原创 2017-11-25 10:49:22 · 386 阅读 · 0 评论 -
PAT - 甲级 - 1046. Shortest Distance (20)(模拟)
The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specification:Each input file c原创 2017-11-25 10:56:50 · 387 阅读 · 0 评论 -
PAT - 甲级 - 1051. Pop Sequence (25)(模拟)
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 t原创 2017-11-25 11:02:52 · 461 阅读 · 0 评论 -
PAT - 甲级 - 1105. Spiral Matrix (25)(模拟)
题目描述:This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in from the first element at the upper-left corner, then原创 2017-03-30 11:28:03 · 536 阅读 · 0 评论