随笔分类 -  pat

1 2 3 4 5 ··· 7 下一页
problems from pat
摘要: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 @ 2018-09-04 19:29 赖兴宇 阅读(285) 评论(0) 推荐(0)
摘要:When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A socia 阅读全文
posted @ 2018-09-04 17:03 赖兴宇 阅读(463) 评论(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-09-04 15:55 赖兴宇 阅读(154) 评论(0) 推荐(0)
摘要:Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that 阅读全文
posted @ 2018-09-03 22:38 赖兴宇 阅读(180) 评论(0) 推荐(0)
摘要:The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. 阅读全文
posted @ 2018-09-03 22:33 赖兴宇 阅读(229) 评论(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-09-03 20:15 赖兴宇 阅读(207) 评论(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 exampl 阅读全文
posted @ 2018-09-03 17:00 赖兴宇 阅读(98) 评论(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 @ 2018-09-03 15:31 赖兴宇 阅读(230) 评论(0) 推荐(0)
摘要:This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in from the fi 阅读全文
posted @ 2018-09-02 18:12 赖兴宇 阅读(257) 评论(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 that 阅读全文
posted @ 2018-09-02 18:06 赖兴宇 阅读(176) 评论(0) 推荐(0)
摘要:Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push ( 阅读全文
posted @ 2018-09-02 18:02 赖兴宇 阅读(147) 评论(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 @ 2018-09-02 17:56 赖兴宇 阅读(320) 评论(0) 推荐(1)
摘要: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 @ 2018-09-02 16:21 赖兴宇 阅读(182) 评论(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 @ 2018-09-02 15:13 赖兴宇 阅读(727) 评论(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 @ 2018-09-02 11:15 赖兴宇 阅读(351) 评论(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-09-02 10:35 赖兴宇 阅读(192) 评论(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-08-31 16:11 赖兴宇 阅读(259) 评论(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-08-27 22:06 赖兴宇 阅读(239) 评论(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 @ 2018-08-27 22:01 赖兴宇 阅读(133) 评论(0) 推荐(0)
摘要:The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants. A binary search tree (BST) i 阅读全文
posted @ 2018-08-27 09:52 赖兴宇 阅读(143) 评论(0) 推荐(0)

1 2 3 4 5 ··· 7 下一页