PAT
智渊
这个作者很懒,什么都没留下…
展开
-
PAT A1025【 PAT Ranking】
题目要求:Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the rank...原创 2018-07-23 22:44:28 · 981 阅读 · 0 评论 -
pat A 1053 Path of Equal Weight (30)(30 分)
题目简介:Given a non-empty tree with root R, and with weight W~i~ assigned to each tree node T~i~. The weight of a path from R to L is defined to be the sum of the weights of all the nodes along the pat...原创 2018-08-17 00:57:23 · 454 阅读 · 2 评论 -
PAT A1059 Prime Factors (25)(25 分
题目描述: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~\^k~m~.Input Specification:Each input file c...原创 2018-08-03 00:15:11 · 171 阅读 · 0 评论 -
PAT B1013 数素数 (20)(20 分)
题目描述:令P~i~表示第i个素数。现任给两个正整数M <= N <= 10^4^,请输出P~M~到P~N~的所有素数。输入格式:输入在一行中给出M和N,其间以空格分隔。输出格式:输出从P~M~到P~N~的所有素数,每10个数字占1行,其间以空格分隔,但行末不得有多余空格。输入样例:5 27输出样例:11 13 17 19 23 29 31 3...原创 2018-08-02 22:21:44 · 391 阅读 · 0 评论 -
PAT A1020 Tree Traversals (25)(25 分)
题目要求: Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal s...原创 2018-08-14 22:55:06 · 203 阅读 · 0 评论 -
PAT A1052 Linked List Sorting (25)(25 分)
题目描述:A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. N...原创 2018-08-07 11:29:32 · 155 阅读 · 0 评论 -
PAT A 1060 Are They Equal (25)(25 分)
题目介绍:If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123*10^5^ with simple chopping. Now given the number of ...原创 2018-08-05 23:25:58 · 436 阅读 · 3 评论 -
PAT B1045 1045 快速排序(25)(25 分)
题目描述: 著名的快速排序算法里有一个经典的划分过程:我们通常采用某种方法取一个元素作为主元,通过交换,把比主元小的元素放到它的左边,比主元大的元素放到它的右边。 给定划分后的N个互不相同的正整数的排列,请问有多少个元素可能是划分前选取的主元?例如给定N = 5, 排列是1、3、2、4、5。则:1的左边没有元素,右边的元素都比它大,所以它可能是主元;\尽管3的左边元素都比它小,但是...原创 2018-07-31 21:25:31 · 478 阅读 · 0 评论 -
PAT A1069 The Black Hole of Numbers (20)(20 分)
题目要求: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-decreasing order, a new number can be obtained b...原创 2018-07-31 21:09:34 · 203 阅读 · 0 评论 -
PAT B1040 有几个PAT(25)(25 分)
题目描述: 字符串APPAPT中包含了两个单词“PAT”,其中第一个PAT是第2位(P),第4位(A),第6位(T);第二个PAT是第3位(P),第4位(A),第6位(T)。现给定字符串,问一共可以形成多少个PAT?输入格式:输入只有一行,包含一个字符串,长度不超过10^5^,只包含P、A、T三种字母。输出格式:在一行中输出给定字符串中包含多少个PAT。由于结...原创 2018-07-30 22:56:31 · 267 阅读 · 0 评论 -
PAT B1009 说反话
009 说反话 (20)(20 分)给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过80的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用1个空格分开,输入保证句子末尾没有多余的空格。输出格式:每个测试用例的输出占一行,输出倒序后的句子。输入样例:Hel...原创 2018-07-23 09:49:49 · 560 阅读 · 0 评论 -
PAT A1001 A+B Format (20)(20 分)
题目要求:Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).InputEach input file c...原创 2018-07-29 00:35:19 · 366 阅读 · 0 评论 -
PAT B 1023 组个最小数
题目描述:给定数字0-9各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意0不能做首位)。例如:给定两个0,两个1,三个5,一个8,我们得到的最小的数就是10015558。现给定数字,请编写程序输出能够组成的最小的数。输入格式:每个输入包含1个测试用例。每个测试用例在一行中给出10个非负整数,顺序表示我们拥有数字0、数字1、……数字9的个数...原创 2018-07-28 22:59:07 · 182 阅读 · 0 评论 -
PAT 乙级(B 1020) 月饼
题目要求:(pat B1020)月饼是中国人在中秋佳节时吃的一种传统食品,不同地区有许多不同风味的月饼。现给定所有种类月饼的库存量、总售价、以及市场的最大需求量,请你计算可以获得的最大收益是多少。注意:销售时允许取出一部分库存。样例给出的情形是这样的:假如我们有3种月饼,其库存量分别为18、15、10万吨,总售价分别为75、72、45亿元。如果市场的最大需求量只有20万吨,那么我们最大收益...原创 2018-07-25 12:46:59 · 309 阅读 · 0 评论 -
PAT A1002 A+B for 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 ...原创 2018-09-10 10:34:02 · 255 阅读 · 0 评论