随笔分类 -  pat

problems from pat
摘要:1137 Final Grading (25)(25 分) For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qu 阅读全文
posted @ 2018-06-11 19:28 赖兴宇 阅读(178) 评论(0) 推荐(0)
摘要:Given a set of N (> 1) positive integers, you are supposed to partition them into two disjoint sets A~1~ and A~2~ of n~1~ and n~2~ numbers, respective 阅读全文
posted @ 2018-06-11 18:12 赖兴宇 阅读(160) 评论(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-06-11 15:03 赖兴宇 阅读(132) 评论(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-06-11 12:10 赖兴宇 阅读(161) 评论(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-06-11 11:04 赖兴宇 阅读(212) 评论(0) 推荐(0)
摘要:If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123*10^5^ wit 阅读全文
posted @ 2018-06-11 10:46 赖兴宇 阅读(297) 评论(0) 推荐(0)
摘要:Look-and-say sequence is a sequence of integers as the following: D, D1, D111, D113, D11231, D112213111, ... where D is in [0, 9] except 1. The (n+1)s 阅读全文
posted @ 2018-06-10 23:38 赖兴宇 阅读(151) 评论(0) 推荐(0)
摘要:After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the rank 阅读全文
posted @ 2018-06-10 21:47 赖兴宇 阅读(249) 评论(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-06-10 18:05 赖兴宇 阅读(126) 评论(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-06-10 16:54 赖兴宇 阅读(137) 评论(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-06-10 16:25 赖兴宇 阅读(155) 评论(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 @ 2018-06-09 22:55 赖兴宇 阅读(518) 评论(0) 推荐(0)
摘要:Consider a positive integer N written in standard notation with k+1 digits a~i~ as a~k~...a~1~a~0~ with 0 <= a~i~ < 10 for all i and a~k~ > 0. Then N 阅读全文
posted @ 2018-06-09 22:22 赖兴宇 阅读(199) 评论(0) 推荐(0)
摘要:Cutting an integer means to cut a K digits long integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 1673 阅读全文
posted @ 2018-06-09 21:39 赖兴宇 阅读(118) 评论(0) 推荐(0)
摘要:"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of th 阅读全文
posted @ 2018-06-09 21:26 赖兴宇 阅读(133) 评论(0) 推荐(0)
摘要:Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fold two segments into loops and chain them into one 阅读全文
posted @ 2018-06-09 20:56 赖兴宇 阅读(136) 评论(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-06-09 20:46 赖兴宇 阅读(140) 评论(0) 推荐(0)
摘要:British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number", E -- tha 阅读全文
posted @ 2018-06-09 20:34 赖兴宇 阅读(162) 评论(0) 推荐(0)
摘要:Given three integers A, B and C in [-2^63^, 2^63^], you are supposed to tell whether A+B > C. Input Specification: The first line of the input gives t 阅读全文
posted @ 2018-06-09 20:20 赖兴宇 阅读(191) 评论(0) 推荐(0)
摘要:Two integers are called "friend numbers" if they share the same sum of their digits, and the sum is their "friend ID". For example, 123 and 51 are fri 阅读全文
posted @ 2018-06-09 19:57 赖兴宇 阅读(149) 评论(0) 推荐(0)