PAT
PAT题目
Highlight_Jin
这个作者很懒,什么都没留下…
展开
-
A1074 Reversing Linked List/B1025 反转链表
1074 Reversing Linked List (25 分)Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K=3, then y...原创 2019-04-10 17:08:57 · 372 阅读 · 0 评论 -
A1022 Digital Library
1022 Digital Library (30 分)A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assign...原创 2019-03-27 23:19:52 · 146 阅读 · 0 评论 -
A1046 Shortest Distance
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 Specif...原创 2019-04-10 18:04:24 · 153 阅读 · 0 评论 -
A1097 Deduplication on a Linked List
1097 Deduplication on a Linked List (25 分)Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each value K,...原创 2019-04-10 17:34:58 · 154 阅读 · 0 评论 -
A1049 Counting Ones
1049 Counting Ones (30 分)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. For example, given N bei...原创 2019-03-31 18:25:45 · 202 阅读 · 0 评论 -
A1008 Elevator
1008 Elevator (20 分)The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified...原创 2019-03-31 17:54:07 · 223 阅读 · 0 评论 -
B1003 我要通过!
1003 我要通过! (20 分)“答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于 PAT 的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。得到“答案正确”的条件是:字符串中必须仅有 P、 A、 T这三种字符,不可以包含其它字符; 任意形如 xPATx 的字符串都可以获得“答案正确”,其中 x 或者是空字符串,或者是仅...原创 2019-03-31 17:42:54 · 192 阅读 · 0 评论 -
A1104 Sum of Number Segments/B1049 数列的片段和
1104 Sum of Number Segments (20 分)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 have 10 segme...原创 2019-03-31 16:38:42 · 222 阅读 · 0 评论 -
A1069 The Black Hole of Numbers/B1019 数字黑洞
1019 数字黑洞 (20 分)给定任一个各位数字不完全相同的 4 位正整数,如果我们先把 4 个数字按非递增排序,再按非递减排序,然后用第 1 个数字减第 2 个数字,将得到一个新的数字。一直重复这样做,我们很快会停在有“数字黑洞”之称的 6174,这个神奇的数字也叫 Kaprekar 常数。例如,我们从6767开始,将得到7766 - 6677 = 10899810 - 018...原创 2019-03-31 16:25:43 · 212 阅读 · 0 评论 -
A1082 Read Number in Chinese
1082 Read Number in Chinese (25 分)Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output Fu first if it is negative. For example, -123456789 ...原创 2019-03-24 22:33:12 · 154 阅读 · 0 评论 -
A1005 Spell It Right
1005 Spell It Right (20 分)Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file...原创 2019-03-24 22:42:05 · 142 阅读 · 0 评论 -
A1035 Password
1035 Password (20 分)To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distingu...原创 2019-03-24 22:40:15 · 134 阅读 · 0 评论 -
A1077 Kuchiguse
1077 Kuchiguse (20 分)The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such ...原创 2019-03-24 22:35:25 · 203 阅读 · 0 评论 -
A1038 Recover the Smallest Number
1038 Recover the Smallest Number (30 分)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 recove...原创 2019-03-31 12:10:49 · 243 阅读 · 0 评论 -
A1067 Sort with Swap(0, i)
1067 Sort with Swap(0, i) (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 ...原创 2019-03-31 11:55:31 · 189 阅读 · 0 评论 -
A1007 Maximum Subsequence Sum
1007 Maximum Subsequence Sum (25 分)Given a sequence of K integers { , , ..., }. A continuous subsequence is defined to be { , , ..., } where 1≤i≤j≤K. The Maximum Subsequence is the continu...原创 2019-04-10 22:02:16 · 185 阅读 · 0 评论 -
A1045 Favorite Color Stripe
1045 Favorite Color Stripe (30 分)Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pi...原创 2019-04-11 20:24:43 · 206 阅读 · 0 评论 -
A1085 Perfect Sequence
1085 Perfect Sequence (25 分)Given a sequence of positive integers and another positive integer p. The sequence is said to be a perfect sequence if M≤m×p where M and m are the maximum and minimum num...原创 2019-04-01 21:06:58 · 211 阅读 · 0 评论 -
A1052 Linked List Sorting
1052 Linked List Sorting (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 pointe...原创 2019-04-10 00:19:57 · 187 阅读 · 0 评论 -
A1032 Sharing
1032 Sharing (25 分)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...原创 2019-04-09 23:24:21 · 263 阅读 · 0 评论 -
B1010 一元多项式求导 (25 分)
1010 一元多项式求导 (25 分)设计函数求一元多项式的导数。(注:(n为整数)的一阶导数为n。)输入格式:以指数递降方式输入多项式非零项系数和指数(绝对值均为不超过 1000 的整数)。数字间以空格分隔。输出格式:以与输入相同的格式输出导数多项式非零项的系数和指数。数字间以空格分隔,但结尾不能有多余空格。注意“零多项式”的指数和系数都是 0,但是表示为 0 0。输入样...原创 2019-04-12 21:51:38 · 236 阅读 · 0 评论 -
A1065 A+B and C (64bit)
1065 A+B and C (64bit) (20 分)Given three integers A, B and C in [−,], you are supposed to tell whether A+B>C.Input Specification:The first line of the input gives the positive number of tes...原创 2019-04-12 21:19:31 · 344 阅读 · 0 评论 -
A1056 Mice and Rice
1056 Mice and Rice (25 分)Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each m...原创 2019-04-09 21:58:22 · 175 阅读 · 0 评论 -
A1051 Pop Sequence
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 ...原创 2019-04-08 23:35:42 · 137 阅读 · 0 评论 -
A1088 Rational Arithmetic/B1034 有理数四则运算
1088 Rational Arithmetic (20 分)For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.Input Specification:Ea...原创 2019-04-02 23:46:00 · 223 阅读 · 0 评论 -
A1081 Rational Sum
1081 Rational Sum (20 分)Given N rational numbers in the form numerator/denominator, you are supposed to calculate their sum.Input Specification:Each input file contains one test case. Each case ...原创 2019-04-02 22:32:40 · 169 阅读 · 0 评论 -
A1040 Longest Symmetric String
1040 Longest Symmetric String (25 分)Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub...原创 2019-04-11 20:54:36 · 143 阅读 · 0 评论 -
A1084 Broken Keyboard/B1029 旧键盘
1084 Broken Keyboard (20 分)On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.Now given a st...原创 2019-04-01 20:44:28 · 152 阅读 · 0 评论 -
A1047 Student List for Course
1047 Student List for Course (25 分)Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student na...原创 2019-03-28 22:38:20 · 112 阅读 · 0 评论 -
A1039 Course List for Student
1039 Course List for Student (25 分)Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered co...原创 2019-03-28 22:06:42 · 156 阅读 · 0 评论 -
A1025 PAT Ranking
1025 PAT Ranking (25 分)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 pl...原创 2019-03-28 15:50:24 · 143 阅读 · 0 评论 -
A1044 Shopping in Mars
1044 Shopping in Mars (25 分)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 the payment, the cha...原创 2019-04-01 21:37:44 · 218 阅读 · 0 评论 -
A1037 Magic Coupon
1037 Magic Coupon (25 分)The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times t...原创 2019-03-31 11:03:46 · 159 阅读 · 0 评论 -
A1001 A+B Format
1001 A+B Format (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).Input Spe...原创 2019-03-23 21:45:14 · 120 阅读 · 0 评论 -
B1048 数字加密
1048 数字加密 (20 分)本题要求实现一种数字加密方法。首先固定一个加密用正整数 A,对任一正整数 B,将其每 1 位数字与 A 的对应位置上的数字进行以下运算:对奇数位,对应位的数字相加后对 13 取余——这里用 J 代表 10、Q 代表 11、K 代表 12;对偶数位,用 B 的数字减去 A 的数字,若结果为负数,则再加 10。这里令个位为第 1 位。输入格式:输入在一行中依...原创 2019-03-23 21:26:42 · 124 阅读 · 0 评论 -
B1033 旧键盘打字
1033 旧键盘打字 (20 分)旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现。现在给出应该输入的一段文字、以及坏掉的那些键,打出的结果文字会是怎样?输入格式:输入在 2 行中分别给出坏掉的那些键、以及应该输入的文字。其中对应英文字母的坏键以大写给出;每段文字是不超过 105 个字符的串。可用的字符包括字母 [a-z, A-Z]、数字 0-9、以及下划线 _(...原创 2019-03-29 21:33:58 · 119 阅读 · 0 评论 -
A1073 Scientific Notation/B1024 科学计数法
1073 Scientific Notation (20 分)Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+-][1-9].[0-9]+E[+-...原创 2019-03-22 22:47:03 · 167 阅读 · 0 评论 -
B1014/A1061 福尔摩斯的约会
1014 福尔摩斯的约会 (20 分)大侦探福尔摩斯接到一张奇怪的字条:我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm。大侦探很快就明白了,字条上奇怪的乱码实际上就是约会的时间星期四 14:04,因为前面两字符串中第 1 对相同的大写英文字母(大小写有区分)是第 4 个字母 D,代表星期四;第 2 对相同...原创 2019-03-22 20:53:58 · 103 阅读 · 0 评论 -
B1002 写出这个数
1002 写出这个数 (20 分)读入一个正整数 n,计算其各位数字之和,用汉语拼音写出和的每一位数字。输入格式:每个测试输入包含 1 个测试用例,即给出自然数 n 的值。这里保证 n 小于 10100。输出格式:在一行内输出 n 的各位数字之和的每一位,拼音数字间有 1 空格,但一行中最后一个拼音数字后没有空格。输入样例:1234567890987654321...原创 2019-03-22 00:19:39 · 151 阅读 · 0 评论 -
B1031 查验身份证
1031 查验身份证 (15 分)一个合法的身份证号码由17位地区、日期编号和顺序编号加1位校验码组成。校验码的计算规则如下:首先对前17位数字加权求和,权重分配为:{7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};然后将计算的和对11取模得到值Z;最后按照以下关系对应Z值与校验码M的值:Z:0 1 2 3 4 5 6 7 8 9 10M:1 0 X 9 ...原创 2019-03-21 22:48:19 · 112 阅读 · 0 评论