PAT
昵称五个字
...
展开
-
【置顶】【PAT】PAT甲级题目及分类总结(持续更新ing)
在2019年3月底,我决定考浙大计院,经过一个月还算凑合的学习,痛定思痛,决定整理整理自己的博客。粗略估计,大概一个月的时间里我AC了31道题,大概用时40个小时上下,毕竟还要把大部分时间花在笔试上。一开始使用Java,到十几题的时候发现有的题真的Java很难通过,痛定思痛转Cpp。这里告诫读者,千万换Cpp而不是继续Java,毕竟我们的目标是满分。我在算法题上有点小基础,前后两次参加蓝桥杯,...原创 2019-04-29 15:53:48 · 60478 阅读 · 16 评论
-
【PAT】A1001 A+B Format 数字相加格式化输出
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...原创 2019-04-06 10:33:47 · 4913 阅读 · 3 评论 -
【PAT 】PAT A1002 A+B for Polynomials 多项式相加【多项式加法】
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...原创 2019-04-06 11:07:43 · 2120 阅读 · 2 评论 -
【PAT】PAT A-1003 Emergency【无向图最短路】【Dijkstra算法】
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...原创 2019-04-08 13:56:34 · 2737 阅读 · 1 评论 -
【PAT】A1004 Counting Leaves 【数组】【DFS】
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...原创 2019-04-08 14:35:17 · 1628 阅读 · 0 评论 -
【PAT】PAT A1005 Spell It Right【字符串处理】【水】
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 ...原创 2019-04-08 15:01:15 · 1277 阅读 · 2 评论 -
【PAT】PAT A-1006 Sign In and Sign Out【简单模拟】
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...原创 2019-04-08 15:07:23 · 1375 阅读 · 0 评论 -
【PAT】 PAT A-1007 Maximum Subsequence Sum
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...原创 2019-04-08 16:03:55 · 1066 阅读 · 0 评论 -
【PAT】PAT A1008 Elevator【水】【简单模拟】
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 sec...原创 2019-04-08 16:21:11 · 1641 阅读 · 0 评论 -
【PAT】PAT A1009 Product of Polynomials【多项式乘法】
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...原创 2019-04-08 22:32:10 · 953 阅读 · 0 评论 -
【PAT】A1010 Radix【进制转换】【二分查找】
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...原创 2019-04-13 12:50:32 · 1343 阅读 · 3 评论 -
【PAT】A1011 World Cup Betting【简单模拟】【水】
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Si...原创 2019-04-13 12:53:30 · 1041 阅读 · 0 评论 -
【PAT】A1012 The Best Rank【排序】
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...原创 2019-04-13 13:03:38 · 1164 阅读 · 2 评论 -
【PAT】 A1013 Battle Over Cities
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...原创 2019-04-13 23:24:15 · 940 阅读 · 0 评论 -
【PAT】PAT A1014 Waiting in Line【快乐模拟】
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 ...原创 2019-04-14 14:16:11 · 1120 阅读 · 2 评论 -
【PAT】1015 Reversible Primes【进制转换】【素数判定】
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...原创 2019-04-14 14:57:17 · 736 阅读 · 0 评论 -
【PAT】A1018 Public Bike Management【Dijkstra算法】【DFS】
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 ...原创 2019-04-26 12:47:56 · 1084 阅读 · 1 评论 -
【PAT】A1019 General Palindromic Number【进制转换】
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...原创 2019-04-26 20:45:54 · 638 阅读 · 0 评论 -
【PAT】A1020 Tree Traversals【树的遍历】【DFS】
Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the cor...原创 2019-05-01 20:19:58 · 906 阅读 · 0 评论 -
【PAT】A-1021 Deepest Root【树】【树的深度】【DFS】
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 ...原创 2019-05-02 21:25:04 · 939 阅读 · 0 评论 -
【PAT】A1022 Digital Library【Map的使用】
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...原创 2019-05-02 21:43:04 · 1007 阅读 · 1 评论 -
【PAT】A1023 Have Fun with Numbers【大整数加法】
代码2//// main.cpp// PAT1023//// Created by 许少钧 on 2019/4/13.// Copyright © 2019年 许少钧. All rights reserved.//#include <iostream>#include <cstdio>#include <algorithm>#in...原创 2019-05-04 21:16:46 · 750 阅读 · 0 评论 -
【PAT】PAT A1016 Phone Bills【排序】
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 ...原创 2019-04-24 16:57:35 · 966 阅读 · 0 评论 -
【PAT】PAT A1017 Queueing at Bank【快乐模拟】
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...原创 2019-04-25 17:13:15 · 809 阅读 · 0 评论 -
【PAT】A1024 Palindromic Number【大整数相加】
这题和A-1023非常相似,使用字符串来表示数组比较方便(因为自带翻转API)。柳婼的代码已经近乎完美了(当然要提高效率应该改用char数组或者int数组实现,但是这题真的没必要),具体看传送门...原创 2019-05-06 21:13:56 · 575 阅读 · 0 评论 -
【PAT】A1025 PAT Ranking【排序】
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...原创 2019-05-06 21:20:44 · 587 阅读 · 0 评论 -
【PAT】A1027 Colors in Mars【进制转换】
People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 dig...原创 2019-05-06 21:34:44 · 516 阅读 · 0 评论 -
【PAT】A1028 List Sorting【排序】
Excel can sort records according to any column. Now you are supposed to imitate this function.InputEach input file contains one test case. For each case, the first line contains two integers N (<...原创 2019-05-06 21:44:44 · 630 阅读 · 0 评论 -
【PAT】A-1029 Median【中位数】
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...原创 2019-06-01 13:06:07 · 238 阅读 · 0 评论 -
【PAT】A1042 Shuffling Machine【简单模拟】
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...原创 2019-06-02 12:33:32 · 839 阅读 · 0 评论 -
【PAT】A1073 Scientific Notation【数字处理】
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 inte...原创 2019-06-20 21:46:10 · 447 阅读 · 1 评论 -
【PAT】A1035 Password【字符串处理】【水】
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 ...原创 2019-06-21 16:27:11 · 758 阅读 · 0 评论 -
【PAT】A-1082 Read Number in Chinese【字符串处理】
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 ...原创 2019-06-25 20:53:04 · 759 阅读 · 0 评论 -
【PAT】A1077 Kuchiguse【字符串处理】
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 ...原创 2019-06-21 21:30:55 · 958 阅读 · 0 评论 -
【PAT】A1062 Talent and Virtue【排序】【水】
About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people’s talent and virtue. According to his theory, a man being outstanding in both talent and virt...原创 2019-06-26 09:53:59 · 448 阅读 · 1 评论 -
【PAT】A1055 The World's Richest【排序】
Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world’s wealthiest people. Now you are supposed to simulate this job, but concentrate only on the peopl...原创 2019-06-26 10:30:45 · 512 阅读 · 0 评论 -
【PAT】A1083 List Grades【排序】【水】
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 output those student records of which the grades ...原创 2019-06-26 10:42:42 · 404 阅读 · 0 评论 -
【PAT】A1033 To Fill or Not to Fill【贪心】
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...原创 2019-07-08 08:40:20 · 993 阅读 · 0 评论 -
【PAT】A-1037 Magic Coupon【贪心】
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...原创 2019-07-08 09:08:00 · 665 阅读 · 2 评论 -
【PAT】A-1038 Recover the Smallest Number【贪心】
Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we can recover many numbers such like 32-321-3214-0229...原创 2019-07-08 09:39:34 · 731 阅读 · 0 评论
分享