
PAT
_APTX4869
这个作者很懒,什么都没留下…
展开
-
8.1 深度优先搜索:A1103 Integer Factorization
A1103 Integer FactorizationTheK−Pfactorization of a positive integerNis to writeNas the sum of theP-th power ofKpositive integers. You are supposed to write a program to find theK−Pfactor...原创 2020-03-11 10:21:32 · 309 阅读 · 0 评论 -
6.4 map的常见用法详解:A1022 Digital Library
A1022 Digital LibraryA 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 ...原创 2020-03-09 18:55:16 · 345 阅读 · 0 评论 -
6.4 map的常见用法详解:A1071 Speech Patterns
A1071 Speech PatternsPeople 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 t...原创 2020-03-09 17:44:45 · 274 阅读 · 0 评论 -
6.4 map的常见用法详解:B1044 火星数字
B1044 火星数字火星人是以 13 进制计数的:地球人的 0 被火星人称为 tret。 地球人数字 1 到 12 的火星文分别为:jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec。 火星人将进位以后的 12 个高位数字分别称为:tam, hel, maa, huh, tou, kes, hei, elo, syy, ...原创 2020-03-09 17:01:45 · 384 阅读 · 0 评论 -
6.3 string的常见用法详解:A1060 Are They Equal
A1060 Are They EqualIf a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as0.123×105with simple chopping. Now give...原创 2020-03-09 16:23:56 · 284 阅读 · 0 评论 -
6.1 vector的常见用法详解:A1047 Student List for Course
A1047 Student List for CourseZhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student name lis...原创 2020-03-06 16:17:50 · 327 阅读 · 0 评论 -
6.1 vector的常见用法详解:A1039 Course List for Student
A1039 Course List for StudentZhejiang 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 l...原创 2020-03-06 15:49:18 · 354 阅读 · 0 评论 -
5.6 大整数运算:A1024 Palindromic Number
A1024 Palindromic NumberA number that will be the same when it is written forwards or backwards is known as aPalindromic Number. For example, 1234321 is a palindromic number. All single digit numbe...原创 2020-03-05 20:29:56 · 391 阅读 · 0 评论 -
5.6 大整数运算:A1023 Have Fun with Numbers
A1023 Have Fun with NumbersNotice 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 ...原创 2020-03-05 19:43:15 · 282 阅读 · 0 评论 -
5.5 质因子分解:A1059 Prime Factors
A1059 Prime FactorsGiven any positive integerN, you are supposed to find all of its prime factors, and write them in the formatN=p1^k1×p2^k2×⋯×pm^km.Input Specificat...原创 2020-03-05 16:42:35 · 342 阅读 · 0 评论 -
5.6 大整数运算:B1017 A除以B
B1017A除以B本题要求计算A/B,其中A是不超过 1000 位的正整数,B是 1 位正整数。你需要输出商数Q和余数R,使得A=B×Q+R成立。输入格式:输入在一行中依次给出A和B,中间以 1 空格分隔。输出格式:在一行中依次输出Q和R,中间以 1 空格分隔。输入样例:123456789050987654321 7输出样例:...原创 2020-03-05 16:09:10 · 292 阅读 · 0 评论 -
5.3 分数的四则运算:A1088 Rational Arithmetic
A1088 Rational ArithmeticFor two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.Input Specification:Each inp...原创 2020-03-04 16:02:00 · 237 阅读 · 0 评论 -
5.3 分数的四则运算:A1081 Rational Sum
A1081 Rational SumGivenNrational numbers in the formnumerator/denominator, you are supposed to calculate their sum.Input Specification:Each input file contains one test case. Each case starts...原创 2020-03-04 15:28:35 · 277 阅读 · 0 评论 -
5.1 简单数学:A1049 Counting Ones
5.1 简单数学:A1049 Counting OnesThe task is simple: given any positive integerN, you are supposed to count the total number of 1's in the decimal form of the integers from 1 toN. For example, givenN...原创 2020-03-03 14:21:30 · 306 阅读 · 0 评论 -
5.1 简单数学:B1003 我要通过!
B1003 我要通过!“答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于 PAT 的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。得到“答案正确”的条件是:字符串中必须仅有P、A、T这三种字符,不可以包含其它字符; 任意形如xPATx的字符串都可以获得“答案正确”,其中x或者是空字符串,或者是仅由字母A...原创 2020-03-03 11:52:27 · 294 阅读 · 0 评论 -
4.7 其它高效技巧与算法:A1101 Quick Sort
A1101 Quick SortThere is a classical process namedpartitionin the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less than the pivot a...原创 2020-03-03 10:43:51 · 260 阅读 · 0 评论 -
4.7 其它高效技巧与算法:A1093 Count PAT's
A1093 Count PAT'sThe stringAPPAPTcontains twoPAT'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 6t...原创 2020-03-03 10:21:43 · 270 阅读 · 0 评论 -
4.6 two pointers:A1029 Median
A1029 MedianGiven 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, 1...原创 2020-03-03 10:04:15 · 250 阅读 · 0 评论 -
4.6 two pointers:A1089 Insert or Merge
A1089 Insert or MergeAccording to Wikipedia:Insertion sortiterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one eleme...原创 2020-03-02 21:38:27 · 232 阅读 · 0 评论 -
4.5 二分:A1044 Shopping in Mars
A1044 Shopping in MarsShopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making the payment, the chain can...原创 2020-03-02 13:13:56 · 269 阅读 · 0 评论 -
4.5 二分:A1010 Radix
A1010 RadixGiven a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer isyes, if 6 is a decimal number and 110 is a binary number.Now for any pair of ...原创 2020-03-02 11:39:15 · 264 阅读 · 0 评论 -
4.5 二分:A1085 Perfect Sequence
A1085 Perfect SequenceGiven a sequence of positive integers and another positive integerp. The sequence is said to be aperfect sequenceifM≤m×pwhereMandmare the maximum and minimum numbers i...原创 2020-03-01 12:14:53 · 283 阅读 · 0 评论 -
4.4 贪心:A1033 To Fill or Not to Fill
A1033 To Fill or Not to FillWith 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 f...原创 2020-02-29 18:13:28 · 273 阅读 · 0 评论 -
4.4 贪心: A1038 Recover the Smallest Number
A1038 Recover the Smallest NumberGiven 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...原创 2020-02-28 21:13:53 · 259 阅读 · 0 评论 -
4.1 排序:A1095 Cars on Campus
A1095Cars on CampusZhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the inform...原创 2020-02-27 18:13:13 · 480 阅读 · 0 评论 -
算法笔记-上机训练实战指南汇总
3 3.6 字符串处理 B1024/A1073. 科学计数法 4 4.1 排序 A1016. Phone Bills A1025. PAT Ranking ...原创 2020-02-27 13:14:54 · 791 阅读 · 0 评论 -
4.1 排序:A1025 PAT Ranking
1025PAT RankingProgramming 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, a...原创 2020-02-27 13:11:02 · 294 阅读 · 0 评论 -
4.1 排序:A1016 Phone Bills
1016Phone 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 whe...原创 2020-02-27 12:31:26 · 296 阅读 · 0 评论 -
3.6 字符串处理 :B1024/A1073. 科学计数法
#include<iostream>#include<cstdio>#include<stdlib.h>#include<string.h>#include<string>using namespace std;int main(){ char ch[1000],tmp[10]; int i=0,ex...原创 2020-02-24 20:51:52 · 360 阅读 · 0 评论 -
B1009. 说反话
注意点:① 最后一个单词之后输出空格会导致“格式错误”② 若是单点测试,则可使用更简洁的方法,即使用EOF来判断单词是否已经输入完毕#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<string>usi...原创 2020-02-24 18:06:02 · 261 阅读 · 0 评论 -
PAT乙级真题:福尔摩斯的约会 (20)
福尔摩斯的约会 (20)时间限制1000 ms 内存限制32768 KB 代码长度限制100 KB 判断程序Standard题目描述大侦探福尔摩斯接到一张奇怪的字条:“我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm”。大侦探很 快就明白了,字条上奇怪的乱码实际上就是约...原创 2019-04-13 21:22:32 · 292 阅读 · 0 评论 -
PAT乙级真题1003:数素数 (20)
数素数 (20)时间限制1000 ms 内存限制32768 KB 代码长度限制100 KB 判断程序Standard题目描述令Pi表示第i个素数。现任给两个正整数M <= N <= 10000,请输出PM到PN的所有素数。输入描述:输入在一行中给出M和N,其间以空格分隔。输出描述:输出从PM到PN的所有素数,每10个数字占1...原创 2019-04-12 21:47:06 · 254 阅读 · 0 评论 -
PAT乙级真题1002:数字分类
数字分类 (20)时间限制1000 ms 内存限制32768 KB 代码长度限制100 KB 判断程序Standard题目描述给定一系列正整数,请按要求对数字进行分类,并输出以下5个数字:A1 = 能被5整除的数字中所有偶数的和;A2 = 将被5除后余1的数字按给出顺序进行交错求和,即计算n1-n2+n3-n4...;A3 = 被5除后余2的数字的个数...原创 2019-04-07 23:01:23 · 291 阅读 · 0 评论 -
PAT乙级真题1001:A+B和C
A+B和C (15)时间限制1000 ms 内存限制32768 KB 代码长度限制100 KB 判断程序Standard题目描述给定区间[-2的31次方, 2的31次方]内的3个整数A、B和C,请判断A+B是否大于C。输入描述:输入第1行给出正整数T(<=10),是测试用例的个数。随后给出T组测试用例,每组占一行,顺序给出A、B和C。整数间以...原创 2019-04-07 22:58:21 · 369 阅读 · 0 评论