03 2018 档案

摘要: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 阅读全文
posted @ 2018-03-29 12:28 王清河 阅读(159) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-03-29 11:54 王清河 阅读(100) 评论(0) 推荐(0) 编辑
摘要: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 tha 阅读全文
posted @ 2018-03-28 15:01 王清河 阅读(95) 评论(0) 推荐(0) 编辑
摘要: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 produc 阅读全文
posted @ 2018-03-28 10:44 王清河 阅读(117) 评论(0) 推荐(0) 编辑
摘要: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 s 阅读全文
posted @ 2018-03-27 15:48 王清河 阅读(136) 评论(0) 推荐(0) 编辑
摘要:Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional 阅读全文
posted @ 2018-03-27 09:20 王清河 阅读(168) 评论(0) 推荐(0) 编辑
摘要:给定数字0-9各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意0不能做首位)。例如:给定两个0,两个1,三个5,一个8,我们得到的最小的数就是10015558。 现给定数字,请编写程序输出能够组成的最小的数。 输入格式: 每个输入包含1个测试用例。每个测试 阅读全文
posted @ 2018-03-27 08:27 王清河 阅读(90) 评论(0) 推荐(0) 编辑
摘要: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 cou 阅读全文
posted @ 2018-03-27 08:12 王清河 阅读(109) 评论(0) 推荐(0) 编辑
摘要:Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to c 阅读全文
posted @ 2018-03-26 09:49 王清河 阅读(96) 评论(0) 推荐(0) 编辑
摘要: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 numbe 阅读全文
posted @ 2018-03-25 20:43 王清河 阅读(108) 评论(0) 推荐(0) 编辑
摘要:编程团体赛的规则为:每个参赛队由若干队员组成;所有队员独立比赛;参赛队的成绩为所有队员的成绩和;成绩最高的队获胜。 现给定所有队员的比赛成绩,请你编写程序找出冠军队。 输入格式: 输入第一行给出一个正整数N(<=10000),即所有参赛队员总数。随后N行,每行给出一位队员的成绩,格式为:“队伍编号- 阅读全文
posted @ 2018-03-25 20:05 王清河 阅读(119) 评论(0) 推荐(0) 编辑
摘要:给定一个长度不超过10000的、仅由英文字母构成的字符串。请将字符重新调整顺序,按“PATestPATest....”这样的顺序输出,并忽略其它字符。当然,六种字符的个数不一定是一样多的,若某种字符已经输出完,则余下的字符仍按PATest的顺序打印,直到所有字符都被输出。 输入格式: 输入在一行中给 阅读全文
posted @ 2018-03-25 19:55 王清河 阅读(88) 评论(0) 推荐(0) 编辑
摘要:请编写程序,找出一段给定文字中出现最频繁的那个英文字母。 输入格式: 输入在一行中给出一个长度不超过1000的字符串。字符串由ASCII码表中任意可见字符及空格组成,至少包含1个英文字母,以回车结束(回车不算在内)。 输出格式: 在一行中输出出现频率最高的那个英文字母及其出现次数,其间以空格分隔。如 阅读全文
posted @ 2018-03-25 19:23 王清河 阅读(124) 评论(0) 推荐(0) 编辑
摘要:Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of b 阅读全文
posted @ 2018-03-25 15:49 王清河 阅读(160) 评论(0) 推荐(0) 编辑
摘要:本题要求读入N名学生的成绩,将获得某一给定分数的学生人数输出。 输入格式: 输入在第1行给出不超过105的正整数N,即学生总人数。随后1行给出N名学生的百分制整数成绩,中间以空格分隔。最后1行给出要查询的分数个数K(不超过N的正整数),随后是K个分数,中间以空格分隔。 输出格式: 在一行中按查询顺序 阅读全文
posted @ 2018-03-25 15:23 王清河 阅读(142) 评论(0) 推荐(0) 编辑
摘要:旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现。现在给出应该输入的一段文字、以及坏掉的那些键,打出的结果文字会是怎样? 输入格式: 输入在2行中分别给出坏掉的那些键、以及应该输入的文字。其中对应英文字母的坏键以大写给出;每段文字是不超过105个字符的串。可用的字符包括字母[a-z, 阅读全文
posted @ 2018-03-25 15:14 王清河 阅读(150) 评论(0) 推荐(0) 编辑
摘要: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 sc 阅读全文
posted @ 2018-03-25 13:36 王清河 阅读(108) 评论(0) 推荐(0) 编辑
摘要:It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if 阅读全文
posted @ 2018-03-24 16:27 王清河 阅读(157) 评论(0) 推荐(0) 编辑
摘要:Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and 阅读全文
posted @ 2018-03-23 10:58 王清河 阅读(175) 评论(0) 推荐(0) 编辑
摘要:The ranklist of PAT is generated from the status list, which shows the scores of the submittions. This time you are supposed to generate the ranklist 阅读全文
posted @ 2018-03-23 10:23 王清河 阅读(136) 评论(0) 推荐(0) 编辑
摘要:Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world's wealthiest people. Now you are supposed to si 阅读全文
posted @ 2018-03-22 17:30 王清河 阅读(142) 评论(0) 推荐(0) 编辑
摘要:Excel can sort records according to any column. Now you are supposed to imitate this function. Input Each input file contains one test case. For each 阅读全文
posted @ 2018-03-22 09:13 王清河 阅读(90) 评论(0) 推荐(0) 编辑
摘要:A long-distance telephone company charges its customers by the following rules: Making a long-distance call costs a certain amount per minute, dependi 阅读全文
posted @ 2018-03-21 18:48 王清河 阅读(154) 评论(0) 推荐(0) 编辑
摘要:There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any s 阅读全文
posted @ 2018-03-16 20:33 王清河 阅读(372) 评论(0) 推荐(0) 编辑
摘要:Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social n 阅读全文
posted @ 2018-03-16 14:57 王清河 阅读(134) 评论(0) 推荐(0) 编辑
摘要:One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is re 阅读全文
posted @ 2018-03-16 13:58 王清河 阅读(304) 评论(0) 推荐(0) 编辑
摘要:A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the 阅读全文
posted @ 2018-03-15 19:52 王清河 阅读(140) 评论(0) 推荐(0) 编辑
摘要:It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that c 阅读全文
posted @ 2018-03-15 14:12 王清河 阅读(105) 评论(0) 推荐(0) 编辑
摘要:A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer 阅读全文
posted @ 2018-03-15 10:49 王清河 阅读(140) 评论(0) 推荐(0) 编辑
摘要:A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer 阅读全文
posted @ 2018-03-15 10:25 王清河 阅读(139) 评论(0) 推荐(0) 编辑
摘要:To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mat 阅读全文
posted @ 2018-03-14 20:55 王清河 阅读(128) 评论(0) 推荐(0) 编辑
摘要:The following is from Max Howell @twitter: Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a 阅读全文
posted @ 2018-03-14 16:31 王清河 阅读(128) 评论(0) 推荐(0) 编辑
摘要: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 exam 阅读全文
posted @ 2018-03-14 14:42 王清河 阅读(206) 评论(0) 推荐(0) 编辑
摘要:An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the 阅读全文
posted @ 2018-03-14 13:23 王清河 阅读(218) 评论(0) 推荐(0) 编辑
摘要:About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people's talent and virtue. According to his theor 阅读全文
posted @ 2018-03-14 10:30 王清河 阅读(151) 评论(0) 推荐(0) 编辑
摘要:Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to ou 阅读全文
posted @ 2018-03-14 09:44 王清河 阅读(155) 评论(0) 推荐(0) 编辑
摘要:One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions 阅读全文
posted @ 2018-03-14 09:09 王清河 阅读(173) 评论(0) 推荐(0) 编辑
摘要:The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the s 阅读全文
posted @ 2018-03-13 16:05 王清河 阅读(133) 评论(0) 推荐(0) 编辑
摘要:The K-P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a program t 阅读全文
posted @ 2018-03-13 14:40 王清河 阅读(118) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-03-13 12:35 王清河 阅读(123) 评论(0) 推荐(0) 编辑
摘要: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 Specificat 阅读全文
posted @ 2018-03-13 10:50 王清河 阅读(134) 评论(0) 推荐(0) 编辑
摘要: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 va 阅读全文
posted @ 2018-03-13 08:51 王清河 阅读(142) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-03-12 19:31 王清河 阅读(119) 评论(0) 推荐(0) 编辑
摘要: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 s 阅读全文
posted @ 2018-03-12 18:58 王清河 阅读(136) 评论(0) 推荐(0) 编辑
摘要: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, 阅读全文
posted @ 2018-03-12 16:56 王清河 阅读(140) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-03-12 15:06 王清河 阅读(98) 评论(0) 推荐(0) 编辑
摘要: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 s 阅读全文
posted @ 2018-03-12 12:55 王清河 阅读(107) 评论(0) 推荐(0) 编辑
摘要: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 t 阅读全文
posted @ 2018-03-12 10:47 王清河 阅读(110) 评论(0) 推荐(0) 编辑
摘要:本题要求实现一种数字加密方法。首先固定一个加密用正整数A,对任一正整数B,将其每1位数字与A的对应位置上的数字进行以下运算:对奇数位,对应位的数字相加后对13取余——这里用J代表10、Q代表11、K代表12;对偶数位,用B的数字减去A的数字,若结果为负数,则再加10。这里令个位为第1位。 输入格式: 阅读全文
posted @ 2018-03-12 10:35 王清河 阅读(207) 评论(0) 推荐(0) 编辑
摘要:Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+- 阅读全文
posted @ 2018-03-11 20:51 王清河 阅读(125) 评论(0) 推荐(0) 编辑
摘要:Sherlock Holmes received a note with some strange strings: "Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm". It took him only a min 阅读全文
posted @ 2018-03-11 15:58 王清河 阅读(108) 评论(0) 推荐(0) 编辑
摘要:给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。 输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过80的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用1个空格分开,输入保证句子末尾没有多余的空格。 输出格式:每个测试用例的 阅读全文
posted @ 2018-03-11 14:12 王清河 阅读(136) 评论(0) 推荐(0) 编辑
摘要:读入一个自然数n,计算其各位数字之和,用汉语拼音写出和的每一位数字。 输入格式:每个测试输入包含1个测试用例,即给出自然数n的值。这里保证n小于10100。 输出格式:在一行内输出n的各位数字之和的每一位,拼音数字间有1 空格,但一行中最后一个拼音数字后没有空格。 输入样例: 12345678909 阅读全文
posted @ 2018-03-11 11:08 王清河 阅读(142) 评论(0) 推荐(0) 编辑
摘要:一个合法的身份证号码由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 阅读全文
posted @ 2018-03-11 10:52 王清河 阅读(206) 评论(0) 推荐(0) 编辑
摘要:让我们用字母B来表示“百”、字母S表示“十”,用“12...n”来表示个位数字n(<10),换个格式来输出任一个不超过3位的正整数。例如234应该被输出为BBSSS1234,因为它有2个“百”、3个“十”、以及个位的4。 输入格式:每个测试输入包含1个测试用例,给出正整数n(<1000)。 输出格式 阅读全文
posted @ 2018-03-11 08:52 王清河 阅读(87) 评论(0) 推荐(0) 编辑
摘要:If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver 阅读全文
posted @ 2018-03-10 19:28 王清河 阅读(116) 评论(0) 推荐(0) 编辑
摘要:People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, wher 阅读全文
posted @ 2018-03-10 19:10 王清河 阅读(156) 评论(0) 推荐(0) 编辑
摘要:A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number 阅读全文
posted @ 2018-03-10 17:03 王清河 阅读(205) 评论(0) 推荐(0) 编辑
摘要:如果你是哈利·波特迷,你会知道魔法世界有它自己的货币系统 —— 就如海格告诉哈利的:“十七个银西可(Sickle)兑一个加隆(Galleon),二十九个纳特(Knut)兑一个西可,很容易。”现在,给定哈利应付的价钱P和他实付的钱A,你的任务是写一个程序来计算他应该被找的零钱。 输入格式: 输入在1行 阅读全文
posted @ 2018-03-10 16:42 王清河 阅读(115) 评论(0) 推荐(0) 编辑
摘要:Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, "helloworld" can be printed as: That is 阅读全文
posted @ 2018-03-10 15:05 王清河 阅读(114) 评论(0) 推荐(0) 编辑
摘要:A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a progra 阅读全文
posted @ 2018-03-10 09:44 王清河 阅读(270) 评论(0) 推荐(0) 编辑
摘要:本题要求你写个程序把给定的符号打印成沙漏的形状。例如给定17个“*”,要求按下列格式打印 所谓“沙漏形状”,是指每行输出奇数个符号;各行符号中心对齐;相邻两行符号数差2;符号数先从大到小顺序递减到1,再从小到大顺序递增;首尾符号数相等。 给定任意N个符号,不一定能正好组成一个沙漏。要求打印出的沙漏能 阅读全文
posted @ 2018-03-09 16:18 王清河 阅读(122) 评论(0) 推荐(0) 编辑
摘要:美国总统奥巴马不仅呼吁所有人都学习编程,甚至以身作则编写代码,成为美国历史上首位编写计算机代码的总统。2014年底,为庆祝“计算机科学教育周”正式启动,奥巴马编写了很简单的计算机代码:在屏幕上画一个正方形。现在你也跟他一起画吧! 输入格式: 输入在一行中给出正方形边长N(3<=N<=20)和组成正方 阅读全文
posted @ 2018-03-09 13:08 王清河 阅读(115) 评论(0) 推荐(0) 编辑
摘要:This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students. Inp 阅读全文
posted @ 2018-03-09 12:54 王清河 阅读(129) 评论(0) 推荐(0) 编辑
摘要:At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door 阅读全文
posted @ 2018-03-09 11:11 王清河 阅读(127) 评论(0) 推荐(0) 编辑
摘要:With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing ba 阅读全文
posted @ 2018-03-09 10:29 王清河 阅读(141) 评论(0) 推荐(0) 编辑
摘要:为了用事实说明挖掘机技术到底哪家强,PAT组织了一场挖掘机技能大赛。现请你根据比赛结果统计出技术最强的那个学校。 输入格式: 输入在第1行给出不超过105的正整数N,即参赛人数。随后N行,每行给出一位参赛者的信息和成绩,包括其所代表的学校的编号(从1开始连续编号)、及其比赛成绩(百分制),中间以空格 阅读全文
posted @ 2018-03-08 19:08 王清河 阅读(94) 评论(0) 推荐(0) 编辑
摘要:某城镇进行人口普查,得到了全体居民的生日。现请你写个程序,找出镇上最年长和最年轻的人。 这里确保每个输入的日期都是合法的,但不一定是合理的——假设已知镇上没有超过200岁的老人,而今天是2014年9月6日,所以超过200岁的生日和未出生的生日都是不合理的,应该被过滤掉。 输入格式: 输入在第一行给出 阅读全文
posted @ 2018-03-08 18:49 王清河 阅读(103) 评论(0) 推荐(0) 编辑
摘要:读入n名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的姓名和学号。 输入格式:每个测试输入包含1个测试用例,格式为 其中姓名和学号均为不超过10个字符的字符串,成绩为0到100之间的一个整数,这里保证在一组测试用例中没有两个学生的成绩是相同的。 输出格式:对每个测试用例输出2行,第1行是成 阅读全文
posted @ 2018-03-08 14:55 王清河 阅读(161) 评论(0) 推荐(0) 编辑
摘要:每个PAT考生在参加考试时都会被分配两个座位号,一个是试机座位,一个是考试座位。正常情况下,考生在入场时先得到试机座位号码,入座进入试机状态后,系统会显示该考生的考试座位号码,考试时考生需要换到考试座位就座。但有些考生迟到了,试机已经结束,他们只能拿着领到的试机座位号码求助于你,从后台查出他们的考试 阅读全文
posted @ 2018-03-08 14:36 王清河 阅读(109) 评论(0) 推荐(0) 编辑
摘要: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 occu 阅读全文
posted @ 2018-03-08 14:08 王清河 阅读(108) 评论(0) 推荐(0) 编辑
摘要:Given three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C. Input Specification: The first line of the input gives the p 阅读全文
posted @ 2018-03-08 08:08 王清河 阅读(97) 评论(0) 推荐(0) 编辑
摘要: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 e 阅读全文
posted @ 2018-03-07 20:35 王清河 阅读(97) 评论(0) 推荐(0) 编辑
摘要:Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid "ins 阅读全文
posted @ 2018-03-07 19:59 王清河 阅读(114) 评论(0) 推荐(0) 编辑
摘要:As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some ro 阅读全文
posted @ 2018-03-07 18:08 王清河 阅读(166) 评论(0) 推荐(0) 编辑

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