
技巧题
文章平均质量分 75
感觉自己就是个bug
这个作者很懒,什么都没留下…
展开
-
1016 Phone Bills (25 分)
1016 Phone Bills (25 分)A long-distance telephone company charges its customers by the following rules:Making a long-distance call costs a certain amount per minute, depending on the time of day when the call is made. When a customer starts connecting a l原创 2021-03-12 10:49:55 · 80 阅读 · 0 评论 -
1017 Queueing at Bank (25 分)
1017 Queueing at Bank (25 分)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 customers have to wait in line behind the yellow line, until it is his/her tur原创 2021-03-12 10:48:47 · 90 阅读 · 0 评论 -
PAT(甲级)2019年冬季考试7-1 Good in C (20 分)
7-1 Good in C (20 分)When your interviewer asks you to write “Hello World” using C, can you do as the following figure shows?Input Specification:Each input file contains one test case. For each case, the first part gives the 26 capital English letters A原创 2021-03-10 14:49:57 · 174 阅读 · 0 评论 -
PAT(甲级)2020年冬季考试7-1 The Closest Fibonacci Number (20分)
7-1The Closest Fibonacci Number(20分)The Fibonacci sequence Fn is defined by Fn+2 =Fn+1 +Fn for n≥0, with F0 =0 and F1 =1. The closest Fibonacci number is defined as the Fibonacci number with the smallest absolute difference with the gi原创 2021-03-10 10:59:54 · 295 阅读 · 0 评论 -
PAT(甲级)2020年春季考试7-4 Replacement Selection (30 分)
7-4 Replacement Selection (30 分)When the input is much too large to fit into memory, we have to do external sorting instead of internal sorting. One of the key steps in external sorting is to generate sets of sorted records (also called runs) with limited原创 2021-03-10 11:00:12 · 458 阅读 · 0 评论 -
PAT(甲级)2020年春季考试7-2 The Judger (25 分)
7-2 The Judger (25 分)A game of numbers has the following rules: at the beginning, two distinct positive integers are given by the judge. Then each player in turn must give a number to the judge. The number must be the difference of two numbers that are pr原创 2021-03-10 11:00:36 · 145 阅读 · 0 评论 -
PAT(甲级)2020年冬季考试7-2 Subsequence in Substring (25分)
7-2Subsequence in Substring(25分)A substring is a continuous part of a string. A subsequence is the part of a string that might be continuous or not but the order of the elements is maintained. For example, given the string atpaaabpabtt, pabt is a substrin原创 2021-03-10 10:58:34 · 464 阅读 · 0 评论 -
PAT(甲级)2020年春季考试7-1 Prime Day (20 分)
7-1 Prime Day (20 分)The above picture is from Sina Weibo, showing May 23rd, 2019 as a very cool “Prime Day”. That is, not only that the corresponding number of the date 20190523 is a prime, but all its sub-strings ended at the last digit 3 are prime numb原创 2021-03-10 11:00:45 · 132 阅读 · 0 评论 -
2020PAT甲级秋季7-2 How Many Ways to Buy a Piece of Land (25分)
7-2How Many Ways to Buy a Piece of Land(25分)The land is for sale in CyberCity, and is divided into several pieces. Here it is assumed that each piece of land has exactly two neighboring pieces, except the first and the last that have only one. One can buy原创 2021-03-08 20:07:12 · 154 阅读 · 0 评论 -
2020PAT甲级秋季7-1 Panda and PP Milk
7-1Panda and PP MilkPP milk (盆盆奶)is Pandas’ favorite. They would line up to enjoy it as show in the picture. On the other hand, they could drink in peace only if they believe that the amount of PP milk is fairly distributed, that is, fatter panda can ha原创 2021-03-08 20:05:16 · 252 阅读 · 0 评论 -
1031 Hello World for U (20 分)
1031 Hello World for U (20 分)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:h de ll rlowoThat is, the characters must be printed in the original原创 2021-03-07 12:23:21 · 86 阅读 · 0 评论 -
1042 Shuffling Machine (20 分)
1042 Shuffling Machine (20 分)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 “inside jobs” where employees collaborate with gamblers by performing inadequate原创 2021-03-06 11:52:23 · 61 阅读 · 0 评论 -
1049 Counting Ones (30 分)
1049 Counting Ones (30 分)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. For example, given N being 12, there are five 1’s in 1, 10, 11, and 12.Input Spe原创 2021-03-06 11:42:22 · 52 阅读 · 0 评论 -
1050 String Subtraction (20 分)
1050 String Subtraction (20 分)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 calculate S1 −S2 for any given strings. However, i原创 2021-03-05 13:58:07 · 71 阅读 · 0 评论 -
1054 The Dominant Color (20 分)
1054 The Dominant Color (20 分)Behind the scenes in the computer’s memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called the dominant color. A strictly原创 2021-03-05 13:55:16 · 69 阅读 · 0 评论 -
1058 A+B in Hogwarts (20 分)
1058 A+B in Hogwarts (20 分)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 Sickles to a Galleon and twenty-nine Knuts to a Sickle, it’s easy enough.” Your原创 2021-03-05 13:49:31 · 117 阅读 · 0 评论 -
1059 Prime Factors (25 分)
1059 Prime Factors (25 分)Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1 k1 ×p2 k2 ×⋯×pm kmInput Specification:Each input file contains one test case which gives a p原创 2021-03-05 13:46:41 · 144 阅读 · 0 评论 -
1060 Are They Equal (25 分)
1060 Are They Equal (25 分)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×105 with simple chopping. Now given the number of significant digits on a machine and原创 2021-03-04 13:36:56 · 116 阅读 · 1 评论 -
1061 Dating (20 分)
1061 Dating (20 分)Sherlock Holmes received a note with some strange strings: Let’s date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm. It took him only a minute to figure out that those strange strings are actually referring to the coded原创 2021-03-04 11:14:14 · 67 阅读 · 1 评论 -
1063 Set Similarity (25 分)
1063 Set Similarity (25 分)Given two sets of integers, the similarity of the sets is defined to be Nc /Nt ×100%, where Nc is the number of distinct common numbers shared by the two sets, and Nt is the total number of distinct numbers in the t原创 2021-03-04 11:05:40 · 59 阅读 · 1 评论 -
1064 Complete Binary Search Tree (30 分)
1064 Complete Binary Search Tree (30 分)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 with keys less than the node’s key.The right subtree of a node co原创 2021-03-04 10:51:45 · 65 阅读 · 1 评论 -
1065 A+B and C (64bit) (20 分)
1065 A+B and C (64bit) (20 分)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 positive number of test cases, T (≤10). Then T test cases follow, eac原创 2021-03-04 10:43:12 · 63 阅读 · 1 评论 -
1068 Find More Coins (30 分)
1068 Find More Coins (30 分)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 could accept all kinds of coins as payments. However, there was a special require原创 2021-03-04 10:29:58 · 111 阅读 · 1 评论 -
1069 The Black Hole of Numbers (20 分)
1069 The Black Hole of Numbers (20 分)For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order, a new number can be obtained by taking the second numbe原创 2021-03-04 09:57:19 · 119 阅读 · 1 评论 -
1073 Scientific Notation (20 分)
1073 Scientific Notation (20 分)Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [±][1-9].[0-9]+E[±][0-9]+ which means that the integer portion has exactly on原创 2021-03-03 13:58:43 · 95 阅读 · 0 评论 -
1071 Speech Patterns (25 分)
1071 Speech Patterns (25 分)People often have a preference among synonyms of the same word. For example, some may prefer “the police”, while others may prefer “the cops”. Analyzing such patterns can help to narrow down a speaker’s identity, which is useful原创 2021-03-03 13:33:16 · 58 阅读 · 0 评论 -
1070 Mooncake (25 分)
1070 Mooncake (25 分)Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional mooncakes according to the region’s culture. Now given the inventory amounts and the原创 2021-03-03 11:26:23 · 101 阅读 · 0 评论 -
1074 Reversing Linked List (25 分)
1074 Reversing Linked List (25 分)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, if K=3, then you must output 3→2→1→6→5→4; if K=4, you must output 4→3→2原创 2021-03-03 11:07:03 · 57 阅读 · 0 评论 -
1077 Kuchiguse (20 分)
1077 Kuchiguse (20 分)The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker’s personality. Such a preference is called “Kuchiguse” and is often exaggerat原创 2021-03-03 09:53:58 · 87 阅读 · 0 评论 -
1081 Rational Sum (20 分)
1081 Rational Sum (20 分)Given N rational numbers in the form numerator/denominator, you are supposed to calculate their sum.Input Specification:Each input file contains one test case. Each case starts with a positive integer N (≤100), followed in the ne原创 2021-03-02 14:14:56 · 115 阅读 · 0 评论 -
1082 Read Number in Chinese (25 分)
1082 Read Number in Chinese (25 分)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 example, -123456789 is read as Fu yi Yi er Qian san Bai si Shi wu Wan liu Qia原创 2021-03-02 14:14:07 · 94 阅读 · 0 评论 -
1085 Perfect Sequence (25 分)
1085 Perfect Sequence (25 分)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 the maximum and minimum numbers in the sequence, respectively.Now given a sequence原创 2021-03-02 13:17:54 · 95 阅读 · 0 评论 -
1088 Rational Arithmetic (20 分)
1088 Rational Arithmetic (20 分)For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.Input Specification:Each input file contains one test case, which gives in one li原创 2021-03-02 11:29:41 · 109 阅读 · 0 评论 -
1096 Consecutive Factors (20 分)
1096 Consecutive Factors (20 分)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, and 7 are the three consecutive numbers. Now given any positive N, you are原创 2021-03-01 13:21:44 · 178 阅读 · 0 评论 -
1097 Deduplication on a Linked List (25 分)
1097 Deduplication on a Linked List (25 分)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 value K, only the first node of which the value or absolute value原创 2021-03-01 13:10:14 · 136 阅读 · 1 评论 -
1101 Quick Sort (25 分)
1101 Quick Sort (25 分)There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less than the pivot are moved to its left and those larger than the pivo原创 2021-02-28 18:17:35 · 53 阅读 · 0 评论 -
1104 Sum of Number Segments (20 分)
1104 Sum of Number Segments (20 分)Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence { 0.1, 0.2, 0.3, 0.4 }, we have 10 segments: (0.1) (0.1, 0.2) (0.1, 0.2, 0.3) (0.1, 0.2, 0.3, 0.4原创 2021-02-28 16:31:38 · 92 阅读 · 0 评论 -
1105 Spiral Matrix (25 分)
1105 Spiral Matrix (25 分)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 first element at the upper-left corner, then move in a clockwise spiral. The matri原创 2021-02-28 16:11:08 · 123 阅读 · 0 评论 -
1108 Finding Average (20 分)
1108 Finding Average (20 分)The basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complicated is that some of the input numbers might not be legal. A legal input is a real number in [−1000,1000] and原创 2021-02-28 11:33:42 · 68 阅读 · 0 评论 -
1109 Group Photo (25 分)
1109 Group Photo (25 分)Formation is very important when taking a group photo. Given the rules of forming K rows with N people as the following:The number of people in each row must be N/K (round down to the nearest integer), with all the extra people (if原创 2021-02-28 11:13:00 · 67 阅读 · 0 评论