随笔分类 -  PAT 甲级

摘要: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 fi 阅读全文
posted @ 2018-09-02 16:44 王清河 阅读(807) 评论(0) 推荐(0) 编辑
摘要: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 }, we 阅读全文
posted @ 2018-09-02 11:13 王清河 阅读(778) 评论(0) 推荐(0) 编辑
摘要: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 th 阅读全文
posted @ 2018-09-02 11:09 王清河 阅读(453) 评论(0) 推荐(0) 编辑
摘要: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, m 阅读全文
posted @ 2018-09-01 19:29 王清河 阅读(196) 评论(0) 推荐(0) 编辑
摘要: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 g 阅读全文
posted @ 2018-09-01 16:33 王清河 阅读(668) 评论(0) 推荐(0) 编辑
摘要:The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed 阅读全文
posted @ 2018-09-01 10:56 王清河 阅读(174) 评论(0) 推荐(0) 编辑
摘要:According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert 阅读全文
posted @ 2018-09-01 10:47 王清河 阅读(166) 评论(0) 推荐(0) 编辑
摘要:For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient. Input Sp 阅读全文
posted @ 2018-08-31 16:08 王清河 阅读(171) 评论(0) 推荐(0) 编辑
摘要:Given N rational numbers in the form numerator/denominator, you are supposed to calculate their sum. Input Specification: Each input file contains one 阅读全文
posted @ 2018-08-31 09:35 王清河 阅读(174) 评论(0) 推荐(0) 编辑
摘要: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-decre 阅读全文
posted @ 2018-08-27 13:28 王清河 阅读(171) 评论(0) 推荐(0) 编辑
摘要:Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p​1​​​k​1​​​​×p​2​​​k​2​​​​×⋯×p​m​​​ 阅读全文
posted @ 2018-08-25 07:57 王清河 阅读(768) 评论(0) 推荐(0) 编辑
摘要:Given two strings S~1~ and S~2~, S = S~1~ - S~2~ is defined to be the remaining string after taking all the characters in S~2~ from S~1~. Your task is 阅读全文
posted @ 2018-08-22 20:16 王清河 阅读(140) 评论(0) 推荐(0) 编辑
摘要:The task is simple: given any positive integer N, you are supposed to count the total number of 1's in the decimal form of the integers from 1 to N. F 阅读全文
posted @ 2018-08-22 20:01 王清河 阅读(107) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-08-20 20:10 王清河 阅读(94) 评论(0) 推荐(0) 编辑
摘要:A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For any pair of players, if there are some tables open 阅读全文
posted @ 2018-08-14 15:51 王清河 阅读(342) 评论(0) 推荐(0) 编辑
摘要: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 1 阅读全文
posted @ 2018-08-12 09:59 王清河 阅读(530) 评论(0) 推荐(0) 编辑
摘要:Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run sim 阅读全文
posted @ 2018-08-11 10:19 王清河 阅读(129) 评论(0) 推荐(0) 编辑
摘要: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 c 阅读全文
posted @ 2018-08-07 21:15 王清河 阅读(143) 评论(0) 推荐(0) 编辑
摘要:Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules 阅读全文
posted @ 2018-08-06 14:08 王清河 阅读(229) 评论(0) 推荐(0) 编辑
摘要:Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push ( 阅读全文
posted @ 2018-08-06 13:44 王清河 阅读(820) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示