- 博客(143)
- 收藏
- 关注
原创 pat 甲级 中位数 A1029 Median (25分)(水题
1029 Median (25分)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 12, and the median of S2 = { 9, 10, 15, 16, 17 } is 15. The median of two sequences is d
2020-08-29 12:17:22
192
原创 pat 甲级 贪心 A1037 Magic Coupon (25分)(简单
1037 Magic Coupon (25分)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 product, you may get N times the value of that product back! What is more, the shop als
2020-08-28 19:11:40
146
原创 pat 甲级 A1052 Linked List Sorting (25分)(简单
1052 Linked List Sorting (25分)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 and a Next pointer to the next structure. Now given a linked list, you are
2020-08-28 19:10:48
155
原创 pat 甲级 贪心 A1070 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
2020-08-28 19:10:38
166
原创 pat 甲级 A1133 Splitting A Linked List (25分)(简单
1133 Splitting A Linked List (25分)Given a singly linked list, you are supposed to rearrange its elements so that all the negative values appear before all of the non-negatives, and all the values in [0, K] appear before all those greater than K. The orde
2020-08-28 19:10:28
96
原创 pat 甲级 贪心 A1125 Chain the Ropes (25分) (简单
1125 Chain the Ropes (25分)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 piece, as shown by the figure. The resulting chain will be treated as another
2020-08-28 19:10:17
132
原创 pat 甲级 字符串 A1005 Spell It Right (20分)
1005 Spell It Right (20分)Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains one test case. Each case occupies one line whic
2020-08-28 19:09:56
116
原创 pat 甲级 字符串 A1035 Password (20分)
1035 Password (20分)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 since it is hard to distinguish 1 (one) from l (L in lowercase), or 0 (zero) from O (
2020-08-28 19:09:47
94
原创 pat 甲级 字符串 A1061 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
2020-08-28 19:09:38
458
原创 pat 甲级 素数 A1059 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 = p1k1×p2k2×⋯×pmkm.Input Specification:Each input file contains one test case which giv
2020-08-28 19:09:27
107
原创 pat 甲级 字符串 A1077 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 exagge...
2020-08-28 19:09:17
173
原创 pat 甲级 排列组合 A1093 Count PAT‘s (25分)
1093 Count PAT's (25分)The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and the 6th characters.Now given any string, you are suppos
2020-08-27 20:08:28
114
原创 pat 甲级 素数 A1152 Google Recruitment (20分)
1152 Google Recruitment (20分)In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the picture below) for recruitment. The content is super-simple, a URL consisting of the first 10-digit prime found in consecutive
2020-08-27 20:08:15
125
原创 pat 甲级 素数 A1116 Come on! Let‘s C (20分)
1116 Come on! Let's C (20分)"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 the contest is for fun, the award rules are funny as the following:0、 The Cha
2020-08-27 20:08:01
120
原创 pat 甲级 因数分解 A1096 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
2020-08-27 20:07:48
106
原创 pat 甲级 字符串 A1071 Speech Patterns (25分)(map
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
2020-08-27 20:07:38
109
原创 pat 甲级 Hash散列 A1048 Find Coins (25分)
#include<cstdio>int hash[10010];int main(){ int n,m,a; scanf("%d %d",&n,&m); for(int i=0;i<n;i++) { scanf("%d",&a); hash[a]++; } for(int i=0;i<10010;i++) { if(hash[i]&&hash[m-i]) { if(i==m-i&&ha.
2020-08-27 20:07:20
120
原创 pat 甲级 数字处理 A1001 A+B Format (20分)
1001 A+B Format (20分)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 than four digits).Input Specification:Each input file contains one test case. Each
2020-08-27 20:06:55
111
原创 pat 甲级 进制转换 A1058 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." You
2020-08-27 20:06:46
105
原创 pat 甲级 数字处理 A1069 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 nu...
2020-08-27 20:06:36
131
原创 pat 甲级 大整数加法 A1136 A Delayed Palindrome (20分)
1136 A Delayed Palindrome (20分)Consider a positive integer N written in standard notation with k+1 digits ai as ak⋯a1a0 with 0≤ai<10 for all i and ak>0. Then N is palindromic if and only if ai=ak−i for all i. Zero is written
2020-08-27 20:06:18
161
原创 pat 甲级 进制转换 A1010 Radix (25分)(二分法
1010 Radix (25分)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 binary number.Now for any pair of positive integers N1 and N2, your task is to
2020-08-25 23:05:36
126
原创 pat 甲级 数字处理 A1073 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
2020-08-25 23:05:22
193
原创 pat 甲级 数字处理 A1108 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
2020-08-25 23:05:11
110
原创 pat 甲级 数字处理 A1060 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
2020-08-25 23:04:56
131
原创 pat 甲级 排队问题 A1109 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
2020-08-25 23:04:44
200
原创 pat 甲级 多项式加法 A1002 A+B for Polynomials (25分)
1002 A+B for Polynomials (25分)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 occupies 2 lines, and each line contains the information of a polynomial:K
2020-08-25 23:04:33
203
原创 pat 甲级 散列 A1092 To Buy or Not to Buy (20分)
1092 To Buy or Not to Buy (20分)Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the owner of the shop would only sell the strings in who...
2020-08-25 23:04:20
132
原创 pat 甲级 散列 A1144 The Missing Number (20分)
1144 The Missing Number (20分)Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list.Input Specification:Each input file contains one test case. For each case, the first line gives a positive integer N (
2020-08-25 23:04:04
147
原创 pat 甲级 散列 A1149 Dangerous Goods Packaging (25分)
1149 Dangerous Goods Packaging (25分)When shipping goods with containers, we have to be careful not to pack some incompatible goods into the same container, or we might get ourselves in serious trouble. For example, oxidizing agent (氧化剂) must not be packe
2020-08-25 23:03:49
179
1
原创 pat 甲级 多项式乘法 A1009 Product of Polynomials (25分)
1009 Product of Polynomials (25分)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 occupies 2 lines, and each line contains the information of a polynomial:
2020-08-25 23:03:34
122
原创 pat 甲级 八皇后问题 A1128 N Queens Puzzle (20分)
1128 N Queens Puzzle (20分)The "eight queens puzzle" is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other. Thus, a solution requires that no two queens share the same row, column, or diagonal. The eig
2020-08-24 09:14:14
229
原创 pat 甲级 贪心 A1113 Integer Set Partition (25分)
1113 Integer Set Partition (25分)Given a set of N (>1) positive integers, you are supposed to partition them into two disjoint sets A1 and A2 of n1 and n2 numbers, respectively. Let S1 and S2 denote the sums of all the numbers in A1
2020-08-24 09:13:33
97
原创 pat 甲级 1091 Acute Stroke (30分) bfs
1091 Acute Stroke (30分)One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions are identified in each MRI slice, your job is to calculate the volume of the stro
2020-08-24 09:13:14
133
原创 pat 甲级 树 A1004 Counting Leaves (30分)
1004 Counting Leaves (30分)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 input file contains one test case. Each case starts with a line containing 0<
2020-08-24 09:12:59
138
原创 pat 甲级 图 A1013 Battle Over Cities (25分) dfs
1013 Battle Over Cities (25分)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 city are closed. We must know immediately if we need to repair any other hig
2020-08-24 09:12:44
80
原创 pat 甲级 动态规划 A1068 Find More Coins (30分) 01背包
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
2020-08-24 09:12:27
123
原创 pat 甲级 动态规划 A1040 Longest Symmetric String (25分)最长回文子串
1040 Longest Symmetric String (25分)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 symmetric sub-string is s PAT&TAP s, hence you must output 11.In
2020-08-24 09:12:12
106
原创 pat甲级 动态规划 A1045 Favorite Color Stripe (30分)
1045 Favorite Color Stripe (30分)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 those unwanted pieces and sewing the remaining parts together to form her
2020-08-24 09:11:56
127
原创 pat 甲级 动态规划 A1007 Maximum Subsequence Sum (25分)最大连续子序列和
1007 Maximum Subsequence Sum (25分)Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1≤i≤j≤K. The Maximum Subsequence is the continuous subsequence which has the lar
2020-08-24 09:11:35
157
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人