07 2019 档案
摘要:Source: PAT A1033 To Fill or Not to Fill (25 分) Description: With highways available, driving a car from Hangzhou to any other city is easy. But since
阅读全文
摘要:Source: PAT A1037 Magic Coupon (25 分) Description: The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it,
阅读全文
摘要:Source: PAT A1038 Recover the Smallest Number (30 分) Description: Given a collection of number segments, you are supposed to recover the smallest numb
阅读全文
摘要:Source: PAT A1067 Sort with Swap(0, i) (25 分) Description: Given any permutation of the numbers {0, 1, 2,..., N−1}, it is easy to sort them in increas
阅读全文
摘要:Source: PAT A1070 Mooncake (25 分) Description: Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of
阅读全文
摘要:Date:2019-07-22 19:33:09 总是选择当前最优的策略,来获得全局最优的解 Sample:
阅读全文
摘要:Source: PAT A1041 Be Unique (20 分) Description: Being unique is so important to people on Mars that even their lottery is designed in a unique way. Th
阅读全文
摘要:Source: PAT A1048 Find Coins (25 分) Description: Eva loves to collect coins from all over the universe, including some other planets like Mars. One da
阅读全文
摘要:Source: PAT A1050 String Subtraction (20 分) Description: Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after
阅读全文
摘要:Source: PAT A1084 Broken Keyboard (20 分) Description: On a broken keyboard, some of the keys are worn out. So when you type some sentences, the charac
阅读全文
摘要:Source: PAT A1092 To Buy or Not to Buy (20 分) Description: Eva would like to make a string of beads with her favorite colors so she went to a small sh
阅读全文
摘要:Source: PAT A1112 Stucked Keyboard (20 分) Description: On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the
阅读全文
摘要:Source: PAT A1117 Eddington Number (25 分) Description: British astronomer Eddington liked to ride a bike. It is said that in order to show off his ski
阅读全文
摘要:Source: PAT A1121 Damn Single (25 分) Description: "Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are supposed to fin
阅读全文
摘要:Source: PAT A1012 The Best Rank (25 分) Description: To evaluate the performance of our first year CS majored students, we consider their grades of thr
阅读全文
摘要:Source: PAT A1016 Phone Bills (25 分) Description: A long-distance telephone company charges its customers by the following rules: Making a long-distan
阅读全文
摘要:Source: PAT A1025 PAT Ranking Description: Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang U
阅读全文
摘要:Source: PAT A1028 List Sorting (25 分) Description: Excel can sort records according to any column. Now you are supposed to imitate this function. Inpu
阅读全文
摘要:Source: PAT A1055 The World's Richest (25 分) Description: Forbes magazine publishes every year its list of billionaires based on the annual ranking of
阅读全文
摘要:Source: PAT A1062 Talent and Virtue (25 分) Description: About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked
阅读全文
摘要:Source: PAT A1075 PAT Judge (25 分) Description: The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This
阅读全文
摘要:Source: PAT A1080 Graduate Admission (30 分) Description: It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 ap
阅读全文
摘要:Source: PAT A1083 List Grades (25 分) Description: Given a list of N student records with name, ID and grade. You are supposed to sort the records with
阅读全文
摘要:Source: PAT A1095 Cars on Campus (30 分) Description: Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out t
阅读全文
摘要:Source: PAT A1101 Quick Sort (25 分) Description: There is a classical process named partition in the famous quick sort algorithm. In this process we t
阅读全文
摘要:Source: PAT A1023 Have Fun with Numbers (20 分) Description: Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1
阅读全文
摘要:Source: PAT A1024 Palindromic Number (25 分) Description: A number that will be the same when it is written forwards or backwards is known as a Palindr
阅读全文
摘要:Source: PAT A1059 Prime Factors (25 分) Description: Given any positive integer N, you are supposed to find all of its prime factors, and write them in
阅读全文
摘要:Source: PAT A1096 Consecutive Factors (20 分) Description: Among all the factors of a positive integer N, there may exist several consecutive numbers.
阅读全文
摘要:Source: PAT A1088 Rational Arithmetic (20 分) Description: For two rational numbers, your task is to implement the basic arithmetics, that is, to calcu
阅读全文
摘要:Source: PAT A1081 Rational Sum (20 分) Description: Given N rational numbers in the form numerator/denominator, you are supposed to calculate their sum
阅读全文
摘要:Date:2019-07-05 19:35:27 算法实现 1 /* 分数的表示和化简 */ 2 /* 3 1.分数的表示 4 */ 5 6 // 7 //1.down非负,若分数为负,则令up为负 8 //2.分数为零,则令up=0, down=1 9 //3.up和down的gcd=1 10 /
阅读全文
摘要:Date:2019-07-05 19:22:40 算法实现
阅读全文
摘要:Source: PAT A1139 First Contact (30 分) Description: Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle
阅读全文
摘要:Source: PAT A1124 Raffle for Weibo Followers (20 分) Description: John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for
阅读全文
摘要:Source: PAT A1130 Infix Expression (25 分) Description: Given a syntax tree (binary), you are supposed to output the corresponding infix expression, wi
阅读全文
摘要:Source: PAT A1091 Acute Stroke (30 分) Description: One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the r
阅读全文
摘要:Date:2019-07-03 14:29:02 走完一层的所有房间,再走下一层,用队列实现 算法实现
阅读全文
摘要:Source: PAT A1103 Integer Factorization (30 分) Description: The K−P factorization of a positive integer N is to write N as the sum of the P-th power o
阅读全文
摘要:Date:2019-07-01 15:31:11 通俗点理解就是不撞南墙不回头的那种,用栈来实现 算法实现
阅读全文