pat
ayouayouwei
不要太垃圾了就好啦
展开
-
L1-002. 打印沙漏
我把这个沙漏呢分成3部分,中间一点,上下两部分,当然上下两部分是一样的,可以当成等差数列,由3开始,5,7,9,这道题,主要是1,求一共几列,2,打印。设置n,n为上面部分的列数,由等差数列的最上面是(2*n+1),而上面部分的总个数为Sn=(3+(2*n+1))*n/2,沙漏的总个数为2*Sn+1, 为了求n,可以列式...原创 2018-02-19 15:29:35 · 271 阅读 · 0 评论 -
PAT Advanced Level 1037 Magic Coupon (25)
The magic shop in Mars is offering some magic coupons. Each coupon hasan integer N printed on it, meaning that when you use this coupon with aproduct, you may get N times the value of that product bac...原创 2018-05-20 20:04:14 · 108 阅读 · 0 评论 -
1005. 继续(3n+1)猜想 (25)
卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里,情况稍微有些复杂。当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数。例如对n=3进行验证的时候,我们需要计算3、5、8、4、2、1,则当我们对n=5、8、4、2进行验证的时候,就可以直接判定卡拉兹猜想的真伪,而不需要重复计算,因为这4个数已经在验证3的时候遇到过了,我们称5、8、4、2是被3“...原创 2018-05-07 22:23:39 · 109 阅读 · 0 评论 -
PAT 甲1038 Recover the Smallest Number (30)
Given a collection of number segments, you are supposed to recover thesmallest number from them. For example, given {32, 321, 3214, 0229, 87},we can recover many numbers such like 32-321-3214-0229-...原创 2018-05-28 21:19:11 · 142 阅读 · 0 评论 -
PAT甲 1033 To Fill or Not to Fill (25)
With highways available, driving a car from Hangzhou to any other cityis easy. But since the tank capacity of a car is limited, we have tofind gas stations on the way from time to time. Different g...原创 2018-05-30 14:39:53 · 136 阅读 · 0 评论 -
1048 Find Coins
1048 Find Coins (25 point(s))Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds...原创 2019-01-17 19:24:37 · 165 阅读 · 0 评论 -
1044 Shopping in Mars (25 point(s))
1044 Shopping in Mars (25 point(s))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, ...原创 2019-01-17 21:02:36 · 154 阅读 · 0 评论 -
1093 Count PAT's
1093 Count PAT's (25 point(s))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 by the 3rd, the 4t...原创 2019-01-24 14:59:06 · 195 阅读 · 0 评论 -
1085 Perfect Sequence
1085 Perfect Sequence (25 point(s))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 mini...原创 2019-01-14 18:37:24 · 207 阅读 · 0 评论 -
1010 Radix
1010 Radix (25 point(s))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...原创 2019-01-15 21:53:52 · 161 阅读 · 0 评论 -
1101 Quick Sort
1101 Quick Sort (25 point(s))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 tha...原创 2019-01-27 18:32:38 · 217 阅读 · 0 评论 -
1049 Counting Ones
1049 Counting Ones (30 point(s))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, give...原创 2019-02-14 23:50:16 · 78 阅读 · 0 评论 -
1069 The Black Hole of Numbers (超时终于找到原因啦)
1069 The Black Hole of Numbers (20 point(s))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-decreasin...原创 2019-02-14 14:40:20 · 1402 阅读 · 1 评论 -
A1041. Be Unique (20)
Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1, 104]. The first one who bets...原创 2018-04-28 21:04:13 · 130 阅读 · 0 评论 -
1043. 输出PATest(20)
给定一个长度不超过10000的、仅由英文字母构成的字符串。请将字符重新调整顺序,按“PATestPATest....”这样的顺序输出,并忽略其它字符。当然,六种字符的个数不一定是一样多的,若某种字符已经输出完,则余下的字符仍按PATest的顺序打印,直到所有字符都被输出。输入格式:输入在一行中给出一个长度不超过10000的、仅由英文字母构成的非空字符串。输出格式:在一行中按题目要求输出排序后的...原创 2018-04-28 20:28:07 · 95 阅读 · 0 评论 -
1029. 旧键盘(20)
时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现。现在给出应该输入的一段文字、以及实际被输入的文字,请你列出肯定坏掉的那些键。输入格式:输入在2行中分别给出应该输入的文字、以及实际被输入的文字。每段文字是不超过80个字符的串,由...原创 2018-04-03 21:17:22 · 110 阅读 · 0 评论 -
L1-003. 个位数统计
L1-003. 个位数统计时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者陈越给定一个k位整数N = dk-1*10k-1 + ... + d1*101 + d0 (0<=di<=9, i=0,...,k-1, dk-1>0),请编写程序统计每种不同的个位数字出现的次数。例如:给定N...原创 2018-02-19 16:00:06 · 140 阅读 · 0 评论 -
L1-007. 念数字
L1-007. 念数字时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者翁恺输入一个整数,输出每个数字对应的拼音。当整数为负数时,先输出“fu”字。十个数字对应的拼音如下:0: ling1: yi2: er3: san4: si5: wu6: liu7: qi8: ba9: jiu...原创 2018-02-22 14:26:23 · 490 阅读 · 0 评论 -
L1-008. 求整数段和
L1-008. 求整数段和时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者杨起帆给定两个整数A和B,输出从A到B的所有整数以及这些数的和。输入格式:输入在一行中给出2个整数A和B,其中-100<=A<=B<=100,其间以空格分隔。输出格式:首先顺序输出从A到B的所有整数,...原创 2018-02-22 14:48:25 · 176 阅读 · 0 评论 -
1009. 说反话 (20)
给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过80的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用1个空格分开,输入保证句子末尾没有多余的空格。输出格式:每个测试用例的输出占一行,输出倒序后的句子。输入样例:Hello World Here I Come输出样例:C...原创 2018-04-07 21:10:27 · 96 阅读 · 0 评论 -
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 places, and the ranklist...原创 2018-03-25 23:57:40 · 93 阅读 · 0 评论 -
1002. 写出这个数 (20)
1002. 写出这个数 (20) 读入一个自然数n,计算其各位数字之和,用汉语拼音写出和的每一位数字。输入格式:每个测试输入包含1个测试用例,即给出自然数n的值。这里保证n小于10100。输出格式:在一行内输出n的各位数字之和的每一位,拼音数字间有1空格,但一行中最后一个拼音数字后没有空格。输入样例:1234567890987654321123456789输出样例:yi san wu#inc...原创 2018-03-21 22:17:22 · 116 阅读 · 0 评论 -
1033. 旧键盘打字(20)
时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现。现在给出应该输入的一段文字、以及坏掉的那些键,打出的结果文字会是怎样?输入格式:输入在2行中分别给出坏掉的那些键、以及应该输入的文字。其中对应英文字母的坏键以大写给出;每段文字是...原创 2018-04-08 21:11:36 · 88 阅读 · 0 评论 -
1038. 统计同成绩学生(20)
时间限制 250 ms 内存限制 65536 kB 代码长度限制 8000 B本题要求读入N名学生的成绩,将获得某一给定分数的学生人数输出。输入格式:输入在第1行给出不超过105的正整数N,即学生总人数。随后1行给出N名学生的百分制整数成绩,中间以空格分隔。最后1行给出要查询的分数个数K(不超过N的正整数),随后是K个分...原创 2018-04-08 21:25:19 · 107 阅读 · 0 评论 -
1004. 成绩排名
1004. 成绩排名 (20) 读入n名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的姓名和学号。输入格式:每个测试输入包含1个测试用例,格式为 第1行:正整数n 第2行:第1个学生的姓名 学号 成绩 第3行:第2个学生的姓名 学号 成绩 ... ... ... 第n+1行:第n个学生的姓名 学号 成绩其中姓名和学号均为不超过10个字符的字符串,成绩为0到100之间...原创 2018-03-26 23:07:09 · 93 阅读 · 0 评论 -
1006. 换个格式输出整数 (15)
让我们用字母B来表示“百”、字母S表示“十”,用“12...n”来表示个位数字n(<10),换个格式来输出任一个不超过3位的正整数。例如234应该被输出为BBSSS1234,因为它有2个“百”、3个“十”、以及个位的4。输入格式:每个测试输入包含1个测试用例,给出正整数n(<1000)。输出格式:每个测试用例的输出占一行,用规定的格式输出n。输入样例1:234输出样例1:BBSS...原创 2018-04-01 22:59:25 · 76 阅读 · 0 评论 -
1032. 挖掘机技术哪家强(20)
为了用事实说明挖掘机技术到底哪家强,PAT组织了一场挖掘机技能大赛。现请你根据比赛结果统计出技术最强的那个学校。输入格式:输入在第1行给出不超过105的正整数N,即参赛人数。随后N行,每行给出一位参赛者的信息和成绩,包括其所代表的学校的编号(从1开始连续编号)、及其比赛成绩(百分制),中间以空格分隔。输出格式:在一行中给出总得分最高的学校的编号、及其总分,中间以空格分隔。题目保证答案唯一,没有...原创 2018-04-01 23:13:04 · 236 阅读 · 0 评论 -
1039. 到底买不买(20)
小红想买些珠子做一串自己喜欢的珠串。卖珠子的摊主有很多串五颜六色的珠串,但是不肯把任何一串拆散了卖。于是小红要你帮忙判断一下,某串珠子里是否包含了全部自己想要的珠子?如果是,那么告诉她有多少多余的珠子;如果不是,那么告诉她缺了多少珠子。为方便起见,我们用[0-9]、[a-z]、[A-Z]范围内的字符来表示颜色。例如在图1中,第3串是小红想做的珠串;那么第1串可以买,因为包含了全部她想要的珠子,...原创 2018-04-10 18:36:53 · 153 阅读 · 0 评论 -
1042. 字符统计(20)
请编写程序,找出一段给定文字中出现最频繁的那个英文字母。输入格式:输入在一行中给出一个长度不超过1000的字符串。字符串由ASCII码表中任意可见字符及空格组成,至少包含1个英文字母,以回车结束(回车不算在内)。输出格式:在一行中输出出现频率最高的那个英文字母及其出现次数,其间以空格分隔。如果有并列,则输出按字母序最小的那个字母。统计时不区分大小写,输出小写字母。输入样例:This is a ...原创 2018-04-10 19:01:29 · 134 阅读 · 0 评论 -
1008 Elevator
1008 Elevator (20 point(s))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 sp...原创 2019-02-14 15:47:32 · 100 阅读 · 0 评论