![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT甲—打卡日记
每日打卡,争取召唤PAT甲级满分神龙
Reza.
宾州州立大学博士在读,主要做点NLP。
个人主页:https://renzelou.github.io/
展开
-
1034 Head of a Gang (30分)
One way that the police finds the head of a gang is to check people’s phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is defined to be t...原创 2020-02-12 14:02:04 · 171 阅读 · 0 评论 -
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 b...原创 2020-02-12 11:16:32 · 166 阅读 · 0 评论 -
1032 Sharing (25分)
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 sublist if they share the same suffix. For example,...原创 2020-02-11 18:45:04 · 212 阅读 · 0 评论 -
1033. To Fill or Not to Fill (25) 贪心算法 (过牛客)
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 stations on the way from time to time. Different ga...原创 2020-02-11 16:49:21 · 440 阅读 · 0 评论 -
1039 Course List for Student (25分)
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 registered course list for each student who comes ...原创 2020-02-10 15:54:30 · 154 阅读 · 0 评论 -
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...原创 2020-02-10 12:22:07 · 185 阅读 · 0 评论 -
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 ...原创 2020-02-10 11:16:40 · 126 阅读 · 0 评论 -
1028 List Sorting (25分)
Excel can sort records according to any column. Now you are supposed to imitate this function.Input Specification:Each input file contains one test case. For each case, the first line contains two i...原创 2020-02-09 11:56:51 · 145 阅读 · 0 评论 -
1025 PAT Ranking (25分)
Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists w...原创 2020-02-09 11:33:58 · 110 阅读 · 0 评论 -
1021 Deepest Root (25分)
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 root that results in a highest tree. Such a root ...原创 2020-02-08 17:12:39 · 99 阅读 · 0 评论 -
1022 Digital Library (30分)
A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number a...原创 2020-02-08 16:52:46 · 148 阅读 · 0 评论 -
1024 Palindromic Number (25分)
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. All single digit numbers are palindromic numbers...原创 2020-02-08 12:25:34 · 143 阅读 · 0 评论 -
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 li...原创 2020-02-07 15:13:01 · 191 阅读 · 0 评论 -
1018 Public Bike Management (30分)
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 station and return it to any other stations in the ...原创 2020-02-07 14:41:51 · 160 阅读 · 0 评论 -
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...原创 2020-02-07 10:38:45 · 114 阅读 · 0 评论 -
1023 Have Fun with Numbers (20分)
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 246913578, which happens to be another 9-digit number con...原创 2020-02-06 15:23:35 · 113 阅读 · 0 评论 -
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 ...原创 2020-02-06 14:19:11 · 192 阅读 · 0 评论 -
1019 General Palindromic Number (20分)
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. All single digit numbers are palindromic numbers...原创 2020-02-06 10:45:50 · 135 阅读 · 0 评论 -
1014. Waiting in Line (30)
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 for the customers to wait in line are:The space ...原创 2020-02-05 13:41:19 · 113 阅读 · 0 评论 -
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 nee...原创 2020-02-05 11:40:30 · 110 阅读 · 0 评论 -
1015 Reversible Primes (20分)
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 reversible prime because its reverse 37 is also a pr...原创 2020-02-05 10:49:10 · 172 阅读 · 0 评论 -
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 int...原创 2020-02-04 14:51:36 · 145 阅读 · 0 评论 -
1012 The Best Rank (25分)
To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), and E - Eng...原创 2020-02-04 13:12:43 · 119 阅读 · 0 评论 -
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 informati...原创 2020-02-04 10:52:18 · 118 阅读 · 0 评论 -
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 w...原创 2020-02-03 12:39:15 · 268 阅读 · 0 评论 -
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 ...原创 2020-02-03 11:45:38 · 142 阅读 · 0 评论 -
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 w...原创 2020-02-03 10:44:32 · 105 阅读 · 0 评论 -
1003 Emergency (25 分)
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 roads. Amount of rescue teams in each city and the l...原创 2020-02-02 12:38:57 · 204 阅读 · 0 评论 -
1002 A+B for Polynomials (25分)
This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynom...原创 2020-02-02 11:22:32 · 132 阅读 · 0 评论 -
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 fil...原创 2020-02-02 10:35:14 · 130 阅读 · 0 评论 -
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 ...原创 2020-02-01 12:09:40 · 126 阅读 · 0 评论 -
1079 Total Sales of Supply Chain (25分)
A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on the...原创 2020-02-01 11:35:36 · 162 阅读 · 0 评论 -
1090 Highest Price in Supply Chain (25分)
A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on the...原创 2020-02-01 11:22:56 · 141 阅读 · 0 评论 -
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 Sic...原创 2020-01-31 11:33:04 · 112 阅读 · 0 评论 -
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 s...原创 2020-01-31 11:10:47 · 184 阅读 · 0 评论 -
1053 Path of Equal Weight (30分)
Given a non-empty tree with root R, and with weight Wiassigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights of all the nodes along the path from R t...原创 2020-01-30 12:49:56 · 137 阅读 · 0 评论 -
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 gambler...原创 2020-01-30 10:58:10 · 115 阅读 · 0 评论 -
1041 Be Unique (20分)
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 number chosen from [1,10^4]. The first one who bets on...原创 2020-01-30 10:23:26 · 167 阅读 · 0 评论 -
1030 Travel Plan (30分)
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 program to help a traveler to decide the shortest path b...原创 2020-01-29 11:52:38 · 136 阅读 · 0 评论 -
1006 Sign In and Sign Out (25分)
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. Given the records of signing in’s and out’s, you...原创 2020-01-29 10:15:18 · 102 阅读 · 0 评论