pat
lzy我就来随便逛逛
纵浪大化中,不喜亦不惧
展开
-
1037 Magic Coupon (25 分)题解 updating
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 t...原创 2019-02-28 21:58:45 · 258 阅读 · 0 评论 -
1050 String Subtraction (20 分)题解 甲级
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 calcu...原创 2019-02-16 18:55:09 · 271 阅读 · 0 评论 -
1042 Shuffling Machine (20 分)题解
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 emp...原创 2019-02-16 17:16:31 · 368 阅读 · 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...原创 2019-02-05 14:55:01 · 613 阅读 · 0 评论 -
pat 甲级 1012 The Best Rank(25)
这道题其实没多大意思,就是求最好排名并把最好排名以及这个排名对应的字母输出,这题就结束了。我的话主要思路是这样的,把每个人每一科的成绩排名都求出,而要求排名,那首先需要先按照成绩排序,直接调用sort函数就行了,排完序再求排名,这个地方有个要注意的点就是某一科同分的人的那个科目的排名是一样的。代码有点小啰嗦,但其实不复杂,就是排序+排名那块再加上最后输出结果的时候做逻辑判断那块有一些啰嗦的代码,照...原创 2019-01-17 18:21:28 · 131 阅读 · 0 评论 -
pat 甲级 1016 phone bill
题目如下: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...原创 2018-10-28 20:18:35 · 267 阅读 · 0 评论 -
PAT甲级1024
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 sin...原创 2018-10-24 20:59:16 · 741 阅读 · 0 评论 -
pat 甲级 1027
1027 Colors in Mars (20 分)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 a...原创 2018-10-22 20:10:55 · 221 阅读 · 0 评论 -
pat 甲级 1021
1021 Deepest Root (25 分)A graph which is connecte d and acyclic can be considered a tree. The hight of the tree depends on the selected root. Now you are supposed to find the root that results in a ...原创 2018-10-22 16:51:09 · 637 阅读 · 2 评论 -
pat甲级1013 参考柳神思路
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...原创 2018-10-21 13:37:14 · 1594 阅读 · 5 评论 -
1004 Counting Leaves 题解 updating
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 on...原创 2019-02-17 17:42:10 · 132 阅读 · 0 评论 -
1046 Shortest Distance (20 分) 超时问题
1046 Shortest Distance (20 分)The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specif...原创 2019-02-21 15:52:20 · 617 阅读 · 0 评论 -
pat 甲级 1007.PAT (Advanced Level) Practice 题解
终于想起我的csdn密码系列。。大概算一算也有接近两个月没更了,一部分因为懒,一部分因为大三期末还是挺重要的,复习+考试前后一个多月,现在写这篇blog的时候已经在家呆了接近两周了,交完三月份的pat甲级考试的报名费接近二百大洋(真的很贵啊,有木有!)原本只要200,现在居然涨价了,用了牛客网的优惠券居然还要200,嘛,这钱就当给自己刷题找个动力喽。 扯远了,言归正传...原创 2019-01-17 13:09:08 · 206 阅读 · 0 评论 -
1051 Pop Sequence (25 分)题解
1051 Pop Sequence (25 分)Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given sequence of numbers is a ...原创 2019-02-28 19:08:49 · 913 阅读 · 0 评论 -
1040 Longest Symmetric String (25 分)题解
1040 Longest Symmetric String (25 分)Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub...原创 2019-02-27 18:05:41 · 648 阅读 · 0 评论 -
1044 Shopping in Mars (25 分)题解
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 cha...原创 2019-02-26 20:37:10 · 469 阅读 · 0 评论 -
1020 Tree Traversals (25 分) 题解
1020 Tree Traversals (25 分)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 ...原创 2019-02-26 20:33:42 · 526 阅读 · 0 评论 -
1041 Be Unique (20 分) 题解
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,104]. T...原创 2019-02-06 16:11:21 · 290 阅读 · 0 评论 -
1031 甲级 Hello World for U (20 分)
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 ...原创 2019-02-06 14:44:14 · 148 阅读 · 0 评论 -
1025 PAT Ranking (25 分) 题解
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 pl...原创 2019-02-05 20:26:02 · 280 阅读 · 0 评论 -
1035 甲级 Password (20 分) 题解
这题其实就是一道水题,简而言之,就是字符串的替换,然后再加一点条件判断,比如n的大小和m的大小,其他没啥了#include<iostream>#include<vector>#include<string>using namespace std;int main(){ int n; cin >> n; vector<st...原创 2019-02-05 15:51:25 · 180 阅读 · 0 评论 -
1009 Product of Polynomials (25 分)题解
先吐槽一下我自己,每次一放假,作息就会乱得一团糟,一玩游戏就啥都忘了,喂喂,pat报名费二百大洋呢!言归正传,先大概讲一下这题什么意思。其实这题就是一个多项式相乘问题,输入两个多项式然后输出相乘的结果,虽然总的来说这题挺简单,但是坑还是有那么几个。首先,输出要按照指数递减顺序,也就是按照数学中的习惯,那么这个地方就需要一个排序,其次要输出非零项个数再输出非零项,这一点我自己刚开始也没有注意到,...原创 2019-01-20 16:25:05 · 1167 阅读 · 0 评论 -
PAT甲级 1029median 参考柳神解题思路
先扔完整代码,可通过在线测试,具体迟点再写#include<iostream>#include<vector>using namespace std;int main(){ int m, n; cin >> m; vector<int> arr1(m); for (int i = 0; i < m; i++) { c...原创 2018-10-13 21:42:46 · 3217 阅读 · 1 评论