摘要: A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes w... 阅读全文
posted @ 2015-09-08 10:16 CAPOUIS 阅读(191) 评论(0) 推荐(0)
摘要: According to Wikipedia:Insertion sortiterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertio... 阅读全文
posted @ 2015-09-08 09:37 CAPOUIS 阅读(104) 评论(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 @ 2015-09-07 10:45 CAPOUIS 阅读(307) 评论(0) 推荐(0)
摘要: Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3*5*6*7, where 5, 6, a... 阅读全文
posted @ 2015-09-07 09:59 CAPOUIS 阅读(179) 评论(0) 推荐(0)
摘要: This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and... 阅读全文
posted @ 2015-07-20 21:08 CAPOUIS 阅读(159) 评论(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 @ 2015-07-20 20:51 CAPOUIS 阅读(110) 评论(0) 推荐(0)
摘要: 字符串APPAPT中包含了两个单词“PAT”,其中第一个PAT是第2位(P),第4位(A),第6位(T);第二个PAT是第3位(P),第4位(A),第6位(T)。现给定字符串,问一共可以形成多少个PAT?输入格式:输入只有一行,包含一个字符串,长度不超过105,只包含P、A、T三种字母。输出格式:在... 阅读全文
posted @ 2015-07-16 21:04 CAPOUIS 阅读(179) 评论(0) 推荐(0)
摘要: 小红想买些珠子做一串自己喜欢的珠串。卖珠子的摊主有很多串五颜六色的珠串,但是不肯把任何一串拆散了卖。于是小红要你帮忙判断一下,某串珠子里是否包含了全部自己想要的珠子?如果是,那么告诉她有多少多余的珠子;如果不是,那么告诉她缺了多少珠子。为方便起见,我们用[0-9]、[a-z]、[A-Z]范围内的字符... 阅读全文
posted @ 2015-07-16 20:57 CAPOUIS 阅读(251) 评论(0) 推荐(0)
摘要: 本题要求读入N名学生的成绩,将获得某一给定分数的学生人数输出。输入格式:输入在第1行给出不超过105的正整数N,即学生总人数。随后1行给出N名学生的百分制整数成绩,中间以空格分隔。最后1行给出要查询的分数个数K(不超过N的正整数),随后是K个分数,中间以空格分隔。输出格式:在一行中按查询顺序给出得分... 阅读全文
posted @ 2015-07-16 20:45 CAPOUIS 阅读(170) 评论(0) 推荐(0)
摘要: 如果你是哈利·波特迷,你会知道魔法世界有它自己的货币系统 —— 就如海格告诉哈利的:“十七个银西可(Sickle)兑一个加隆(Galleon),二十九个纳特(Knut)兑一个西可,很容易。”现在,给定哈利应付的价钱P和他实付的钱A,你的任务是写一个程序来计算他应该被找的零钱。输入格式:输入在1行中分... 阅读全文
posted @ 2015-07-16 20:41 CAPOUIS 阅读(307) 评论(0) 推荐(0)