07 2019 档案

摘要: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. F 阅读全文
posted @ 2019-07-31 14:55 自由之翼Az 阅读(301) 评论(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 @ 2019-07-31 13:39 自由之翼Az 阅读(145) 评论(0) 推荐(0) 编辑
摘要: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 t 阅读全文
posted @ 2019-07-30 23:14 自由之翼Az 阅读(179) 评论(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 @ 2019-07-30 22:35 自由之翼Az 阅读(182) 评论(0) 推荐(0) 编辑
摘要: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 th 阅读全文
posted @ 2019-07-30 22:12 自由之翼Az 阅读(262) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2019-07-29 08:43 自由之翼Az 阅读(281) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2019-07-28 19:58 自由之翼Az 阅读(298) 评论(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 @ 2019-07-28 14:40 自由之翼Az 阅读(239) 评论(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 @ 2019-07-28 13:31 自由之翼Az 阅读(204) 评论(0) 推荐(0) 编辑
摘要: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 symme 阅读全文
posted @ 2019-07-27 23:32 自由之翼Az 阅读(189) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2019-07-27 23:07 自由之翼Az 阅读(121) 评论(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 c 阅读全文
posted @ 2019-07-27 22:25 自由之翼Az 阅读(175) 评论(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 @ 2019-07-27 21:43 自由之翼Az 阅读(263) 评论(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 @ 2019-07-27 20:46 自由之翼Az 阅读(193) 评论(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 @ 2019-07-27 20:32 自由之翼Az 阅读(220) 评论(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 @ 2019-07-27 13:22 自由之翼Az 阅读(227) 评论(0) 推荐(0) 编辑
摘要:A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For any pair of players, if there are some tables open 阅读全文
posted @ 2019-07-27 13:19 自由之翼Az 阅读(314) 评论(0) 推荐(0) 编辑
摘要:A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years 阅读全文
posted @ 2019-07-25 22:02 自由之翼Az 阅读(230) 评论(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 @ 2019-07-24 08:54 自由之翼Az 阅读(170) 评论(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 @ 2019-07-23 10:51 自由之翼Az 阅读(187) 评论(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 @ 2019-07-22 22:20 自由之翼Az 阅读(163) 评论(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 @ 2019-07-22 13:43 自由之翼Az 阅读(645) 评论(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 @ 2019-07-21 14:22 自由之翼Az 阅读(158) 评论(0) 推荐(0) 编辑
摘要:Given any string of N (≥) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as: h d e l l r 阅读全文
posted @ 2019-07-20 23:23 自由之翼Az 阅读(294) 评论(0) 推荐(0) 编辑
摘要:Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 1 阅读全文
posted @ 2019-07-20 22:58 自由之翼Az 阅读(205) 评论(0) 推荐(0) 编辑
摘要:Excel can sort records according to any column. Now you are supposed to imitate this function. Input Specification: Each input file contains one test 阅读全文
posted @ 2019-07-20 22:08 自由之翼Az 阅读(128) 评论(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 @ 2019-07-20 21:36 自由之翼Az 阅读(179) 评论(0) 推荐(0) 编辑
摘要:Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run sim 阅读全文
posted @ 2019-07-19 23:16 自由之翼Az 阅读(180) 评论(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 @ 2019-07-19 22:07 自由之翼Az 阅读(163) 评论(0) 推荐(0) 编辑
摘要:Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 2469135 阅读全文
posted @ 2019-07-17 23:32 自由之翼Az 阅读(154) 评论(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 @ 2019-07-17 22:58 自由之翼Az 阅读(163) 评论(0) 推荐(0) 编辑
摘要:Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the c 阅读全文
posted @ 2019-07-17 22:18 自由之翼Az 阅读(196) 评论(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 @ 2019-07-17 00:01 自由之翼Az 阅读(277) 评论(0) 推荐(0) 编辑
摘要:A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a re 阅读全文
posted @ 2019-07-15 22:54 自由之翼Az 阅读(200) 评论(0) 推荐(0) 编辑
摘要:Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules 阅读全文
posted @ 2019-07-15 21:55 自由之翼Az 阅读(463) 评论(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 @ 2019-07-15 08:52 自由之翼Az 阅读(203) 评论(0) 推荐(0) 编辑
摘要:Problem: 反转单向和双向链表 【题目】 分别实现反转单向链表和反转双向链表的函数。 【要求】 如果链表长度为N,时间复杂度要求为O(N),额外空间 复杂度要求为O(1) Solution: 学会使用指针 阅读全文
posted @ 2019-07-13 17:41 自由之翼Az 阅读(260) 评论(0) 推荐(0) 编辑
摘要:【题目】给定链表的头节点head,实现删除链表的中间节点的函数。例如:不删除任何节点;1->2,删除节点1;1->2->3,删除节点2;1->2->3->4,删除节点2;1->2->3->4->5,删除节点3;进阶:给定链表的头节点head、整数a和b,实现删除位于a / b处节点的函数。例如:链表 阅读全文
posted @ 2019-07-13 17:32 自由之翼Az 阅读(249) 评论(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 @ 2019-07-13 09:14 自由之翼Az 阅读(349) 评论(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 @ 2019-07-12 21:55 自由之翼Az 阅读(140) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2019-07-12 21:24 自由之翼Az 阅读(234) 评论(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 @ 2019-07-11 23:07 自由之翼Az 阅读(201) 评论(0) 推荐(0) 编辑
摘要: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 elev 阅读全文
posted @ 2019-07-11 22:03 自由之翼Az 阅读(178) 评论(0) 推荐(0) 编辑
摘要:Given a sequence of K integers { N​1​​, N​2​​, ..., N​K​​ }. A continuous subsequence is defined to be { N​i​​, N​i+1​​, ..., N​j​​ } where 1. The Max 阅读全文
posted @ 2019-07-11 21:44 自由之翼Az 阅读(209) 评论(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 @ 2019-07-11 20:29 自由之翼Az 阅读(156) 评论(0) 推荐(0) 编辑
摘要:题目描述 输入描述: 输出描述: 输入例子: 输出例子: 阅读全文
posted @ 2019-07-11 20:08 自由之翼Az 阅读(165) 评论(0) 推荐(0) 编辑
摘要:【题目】 一个栈中元素的类型为整型,现在想将该栈从顶到底按从大到小的顺序排序,只许申请一个栈。除此之外,可以申请新的变量,但不能申请额外的数据结构。如何完成排序? 【题解】 将要排序的栈记为stack,申请的辅助栈记为help。在stack上执行pop操作,弹出的元素记为cur。·如果cur小于或等 阅读全文
posted @ 2019-07-11 15:58 自由之翼Az 阅读(234) 评论(0) 推荐(0) 编辑
摘要:【题目】一个栈依次压入1、2、3、4、5,那么从栈顶到栈底分别为5、4、3、2、1。将这个栈转置后,从栈顶到栈底为1、2、3、4、5,也就是实现栈中元素的逆序,但是只能用递归函数来实现,不能用其他数据结构。 【题解】使用两个递归函数:一个递归函数是将栈底的元素返回并删除另一个函数是将返回的元素进行存 阅读全文
posted @ 2019-07-11 15:43 自由之翼Az 阅读(223) 评论(0) 推荐(0) 编辑
摘要:A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Specification: Each inp 阅读全文
posted @ 2019-07-11 14:36 自由之翼Az 阅读(168) 评论(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 @ 2019-07-10 23:13 自由之翼Az 阅读(201) 评论(0) 推荐(0) 编辑
摘要:Djkstra算法示例演示 下面我求下图,从顶点v1到其他各个顶点的最短路径 首先第一步,我们先声明一个dis数组,该数组初始化的值为: 我们的顶点集T的初始化为:T={v1} 既然是求 v1顶点到其余各个顶点的最短路程,那就先找一个离 1 号顶点最近的顶点。通过数组 dis 可知当前离v1顶点最近 阅读全文
posted @ 2019-07-10 23:02 自由之翼Az 阅读(790) 评论(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 @ 2019-07-09 20:06 自由之翼Az 阅读(224) 评论(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 tha 阅读全文
posted @ 2019-07-09 19:01 自由之翼Az 阅读(200) 评论(0) 推荐(0) 编辑
摘要:题目描述 输入描述: 输出描述: 输入例子: 输出例子: 版本一: 例版本一: 版本三: 笨死了,英语理解能力不好,其实就是监测每次的输入,当输入某种颜色的个数过半,则立马输出! 阅读全文
posted @ 2019-07-09 17:16 自由之翼Az 阅读(181) 评论(0) 推荐(0) 编辑
摘要:题目描述 输入描述: 输出描述: 输入例子: 输出例子: 解题思路: 版本一: 该版本的缺陷是,当出现相同数字时,无法在中序中确定谁是根节点! 版本二: 阅读全文
posted @ 2019-07-09 16:02 自由之翼Az 阅读(148) 评论(0) 推荐(0) 编辑
摘要:题目描述 输入描述: 输出描述: 输入例子: 输出例子: 阅读全文
posted @ 2019-07-06 19:36 自由之翼Az 阅读(188) 评论(0) 推荐(0) 编辑
摘要:题目描述 输入描述: 输出描述: 输入例子: 输出例子: 阅读全文
posted @ 2019-07-06 16:23 自由之翼Az 阅读(288) 评论(0) 推荐(0) 编辑

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