
PAT-A
asianleolion
这个作者很懒,什么都没留下…
展开
-
1003 Emergency (25 分)
#Keywords: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 t...原创 2019-07-23 20:29:52 · 127 阅读 · 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...原创 2019-08-04 23:39:19 · 103 阅读 · 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...原创 2019-08-05 14:52:29 · 120 阅读 · 0 评论 -
1038 Recover the Smallest Number (30 分) 建议贪心, string的sort
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-08-05 15:14:14 · 190 阅读 · 0 评论 -
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 ...原创 2019-08-05 15:51:21 · 406 阅读 · 0 评论 -
1010 Radix (25 分)二分 溢出 k1进制与k2进制的比较 重做
Input Specification:Each input file contains one test case. Each case occupies a line which contains 4 positive integers:N1 N2 tag radixHere N1 and N2 each has no more than 10 digits. A digit is le...原创 2019-08-05 17:55:55 · 141 阅读 · 0 评论 -
1085 Perfect Sequence (25 分) 双指针, 短小精悍
Given a sequence of positive integers and another positive integer p. The sequence is said to be a perfect sequence if M≤m×p where M and m are the maximum and minimum numbers in the sequence, respecti...原创 2019-08-05 20:08:38 · 201 阅读 · 0 评论 -
1044 Shopping in Mars (25 分) 二分
Shopping 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 be cut at any position ...原创 2019-08-05 21:32:31 · 185 阅读 · 0 评论 -
1048 Find Coins (25 分) 模拟 ->二分
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,...原创 2019-08-05 21:47:24 · 262 阅读 · 0 评论 -
Waiting in Line (30 分)
Input Specification:Each input file contains one test case. Each case starts with a line containing 4 positive integers: N (≤20, number of windows), M (≤10, the maximum capacity of each line inside ...原创 2019-08-01 17:30:26 · 1950 阅读 · 0 评论 -
1081 Rational Sum (20 分)有理分式, 接1088
Given N rational numbers in the form numerator/denominator, you are supposed to calculate their sum.Input Specification:Each input file contains one test case. Each case starts with a positive integ...原创 2019-08-04 19:13:01 · 170 阅读 · 0 评论 -
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 intege...原创 2019-08-04 16:30:54 · 244 阅读 · 0 评论 -
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 ...原创 2019-08-04 14:47:25 · 164 阅读 · 0 评论 -
1087 All Roads Lead to Rome (30 分)
Keyword: Dfs dijkstr, stoiIndeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happiness.I...原创 2019-07-29 20:41:12 · 184 阅读 · 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 ...原创 2019-07-24 21:54:48 · 136 阅读 · 0 评论 -
1015 Reversible Primes (20 分)
isprime 进制转换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...原创 2019-07-29 21:44:43 · 155 阅读 · 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...原创 2019-07-30 20:11:14 · 232 阅读 · 0 评论 -
1050 String Subtraction (20 分)string char[]总结
https://pintia.cn/problem-sets/994805342720868352/problems/994805429018673152Sample Input:They are students.aeiouSample Output:Thy r stdnts.Noteinclude的一些问题文件cstring,和string.h对应,c++版本的头文件,包...原创 2019-07-30 20:42:01 · 104 阅读 · 0 评论 -
1061 Dating (20 分) bug 简单模拟
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...原创 2019-07-30 21:19:42 · 146 阅读 · 0 评论 -
1069 The Black Hole of Numbers (20 分) string 重做
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 takin...原创 2019-07-30 21:48:33 · 257 阅读 · 0 评论 -
1030 Travel Plan (30 分)
Keywords: dij weight on edgeA 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 ...原创 2019-07-25 22:05:38 · 125 阅读 · 0 评论 -
1088 Rational Arithmetic (20 分) 简单模拟,gcd, 分式运算, 心态炸裂
Keywords:简单模拟,gcd, 分式运算, 心态炸裂For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.Input Specification:Each in...原创 2019-08-04 10:47:50 · 311 阅读 · 0 评论 -
1072 Gas Station (30 分)
Keywords: Dij, 审题理解A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must guaran...原创 2019-07-28 20:20:38 · 627 阅读 · 2 评论 -
1097 Deduplication on a Linked List (25 分) 静态链表 时间长
Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each value K, only the first node of which the value or a...原创 2019-08-08 19:27:35 · 142 阅读 · 0 评论 -
中序前序后序层序转换总结
模板链表版(直接建树)1.前序中序建树#include<iostream>#include<vector>#include<algorithm>using namespace std;const int maxn = 1e4 + 10;struct node{ node *lchild; node *rchild; ...原创 2019-08-25 21:43:22 · 792 阅读 · 0 评论 -
PAT排序总结
题目列表1012. The Best Rank (25)1013. Phone Bills (25)1017. Queueing at Bank (25)1025. PAT Ranking (25)1026. Table Tennis (30)1028. List Sorting (25)1052. Linked List Sorting (25)1055. The World’s...原创 2019-08-25 22:00:34 · 312 阅读 · 0 评论 -
A1116 A1117 A1118 A1119 模拟练习4
1116 Come on! Let’s C (20 分)Sample Input:61111666688881234555500016888800011111222288882222Sample Output:8888: Minion0001: Chocolate1111: Mystery Award2222: Are you kidding?8888: ...原创 2019-08-12 21:40:14 · 197 阅读 · 0 评论 -
1136 1137 1138 1139 模拟练习
1136 A Delayed Palindrome (20 分)Sample Input 1:97152Sample Output 1:97152 + 25179 = 122331122331 + 133221 = 255552255552 is a palindromic number.Sample Input 2:196Sample Output 2:196 + 691 =...原创 2019-08-16 22:09:11 · 347 阅读 · 0 评论 -
1140 1141 1142 1143模拟练习 (谜之压轴题)
1140 Look-and-say Sequence (20 分)Sample Input:1 8Sample Output:1123123111Note1 11 12 1121 122111 112213 12221131 1123123111题意:没经过一次变换,都用一个数记录之前数出现过的次数思路:先造一个两倍长的string,循环记录即可Code#include&l...原创 2019-08-17 18:57:08 · 273 阅读 · 0 评论 -
1131 Subway Map (30 分) 思维
Keywords: Dfs, 思维In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure shows the map of Beijing subway. Now you are supposed to he...原创 2019-08-27 14:12:37 · 434 阅读 · 0 评论 -
1151 LCA in a Binary Tree (30 分)
The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.Given any two nodes in a binary tree, you are supposed to find their LCA.Inpu...原创 2019-08-31 00:10:23 · 121 阅读 · 0 评论 -
PAT仿真模拟
note1dfs版本Code1#include<bits/stdc++.h>using namespace std;const int maxn = 1000;set<int> save;vector<int> s;int a[maxn][maxn];int visited[maxn] = {0}, liarnum = 0;void D...原创 2019-08-31 22:56:51 · 337 阅读 · 0 评论 -
晴神模拟赛
你们要的中缀表达式树Case Time Limit: 100 MS (Others) / 200 MS (Java) Case Memory Limit: 256 MB (Others) / 512 MB (Java)Accepted: 74 Total Submission: 280Problem Description给定一棵二叉树,二叉树的各个结点要么表示四则运...原创 2019-09-01 15:45:30 · 276 阅读 · 0 评论 -
1133 Splitting A Linked List (25 分)
Keywords: 各种错误总结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 befo...原创 2019-08-15 21:02:37 · 310 阅读 · 0 评论 -
A1112 A1113 A1114 A1115 模拟练习3 待补并查集
1112 Stucked Keyboard (20 分)题目链接Sample Input:3caseee1__thiiis_iiisss_a_teeeeeestSample Output:eicase1__this_isss_a_teestNote1题意, 输入坏键重复的次数,输入字符串,检测坏键思路: 以为要用stl(但是并没有)就没想模拟去解,以后碰到这种题管他麻烦还是不...原创 2019-08-12 00:00:11 · 195 阅读 · 0 评论 -
A1108 A1109 A1110 A1111 模拟练习2
1008题目链接Sample Input 1:75 -3.2 aaa 9999 2.3.4 7.123 2.35Sample Output 1:ERROR: aaa is not a legal numberERROR: 9999 is not a legal numberERROR: 2.3.4 is not a legal numberERROR: 7.123 is not ...原创 2019-08-11 15:56:06 · 283 阅读 · 0 评论 -
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 g...原创 2019-08-06 16:21:01 · 382 阅读 · 0 评论 -
1091 Acute Stroke (30 分)DFS 内存超限, 未完待续
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 c...原创 2019-08-08 21:49:32 · 549 阅读 · 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...原创 2019-08-06 21:51:39 · 168 阅读 · 0 评论 -
1144 1145 1146 1147模拟练习
1144 The Missing Number (20 分)Sample Input:105 -25 9 6 1 3 4 2 5 17Sample Output:7Note找到第一个没有出现的整数Code#include<iostream>#include<cstdio>#include<vector>#include<cmat...原创 2019-08-18 17:12:47 · 239 阅读 · 0 评论