PAT 三月 29, 2020

PAT甲级 1101 Quick Sort (25分)

文章字数 4k 阅读约需 4 mins. 阅读次数 -

There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less than the pivot are moved to its left and those larger than the pivot to its right. Given N distinct positive integers after a run of partition, could you tell how many elements could be the selected pivot for this partition?

For example, given N=5 and the numbers 1, 3, 2, 4, and 5. We have:

  • 1 could be the pivot since there is no element...

PAT 三月 29, 2020

PAT甲级 1010 Radix (25分)

文章字数 4.7k 阅读约需 4 mins. 阅读次数 -

Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number.

Now for any pair of positive integers N1 and N2, your task is to find the radix of one...


PAT 三月 28, 2020

PAT甲级 1085 Perfect Sequence (25分)

文章字数 2.6k 阅读约需 2 mins. 阅读次数 -

Given a sequence of positive integers and another positive integer p. The sequence is said to be a perfect sequence if Mm×p where M and m are the maximum and minimum numbers in the sequence, respectively.

Now given a sequence and a parameter p, you ...


PAT 三月 28, 2020

PAT甲级 1038 Recover the Smallest Number (30分)

文章字数 2.3k 阅读约需 2 mins. 阅读次数 -

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 can recover many numbers such like 32-321-3214-0229-87 or 0229-32-87-321-3214 with respect to different...


PAT 三月 27, 2020

PAT甲级 1067 Sort with Swap(0, i) (25分)

文章字数 2.7k 阅读约需 2 mins. 阅读次数 -

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, 1, 3} we may apply the swap operations in the following...


PAT 三月 26, 2020

PAT乙级 1033 旧键盘打字 (20分)

文章字数 2.1k 阅读约需 2 mins. 阅读次数 -


输入在 2 行中分别给出坏掉的那些键、以及应该输入的文字。其中对应英文字母的坏键以大写给出;每段文字是不超过 $10^5$ 个字符的串。可用的字符包括字母 [a-z, A-Z]、数字 0-9、以及下划线 _(代表空格)、,.-+(代表上档键)。题目保证第 2 行输入的文字串非空。




DUBBO 三月 22, 2020


文章字数 9.3k 阅读约需 8 mins. 阅读次数 -

  • 掌握 API 网关服务聚合功能的实现
  • 掌握 Mybatis-plus 自定义 SQL 实现
  • 掌握 Dubbo 异步调用
  • 服务聚合就是将多个服务调用封装
  • 服务聚合可以简化前端调用方式
  • 服务聚合提供更好的安全性、可扩展性
  • 根据接口文档思考功能列表
  • 实现 API 接口和实体
  • 服务提供者实现

从 guns-user 拷贝一份重命名为 guns-film,修改相关配置

  • 优点
    1. 六个接口,一次请求,同一时刻节省了5次HTTP请求
    2. 同一个接口对外暴露,降低了前后端分离开发的难度和复杂度
  • 缺点:...

PAT 三月 22, 2020

PAT甲级 1095 Cars on Campus (30分)

文章字数 6k 阅读约需 5 mins. 阅读次数 -

Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the information available, you are supposed to tell, at any specific time point, the...


PAT 三月 22, 2020

PAT甲级 1033 To Fill or Not to Fill (25分)

文章字数 5.4k 阅读约需 5 mins. 阅读次数 -

With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Different gas station may give different price. You are asked ...


PAT 三月 20, 2020

PAT甲级 1016 Phone Bills (25分)

文章字数 6.2k 阅读约需 6 mins. 阅读次数 -

A long-distance telephone company charges its customers by the following rules:

Making a long-distance call costs a certain amount per minute, depending on the time of day when the call is made. When a customer starts connecting a long-distance call,...