PAT
love music.
中山大学计算机博士在读,曾就职于腾讯等公司,目前从事人工智能芯片软件研究。
展开
-
PAT(Basic Level) 1003 我要通过!
“答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于PAT的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。得到“答案正确”的条件是:1. 字符串中必须仅有P, A, T这三种字符,不可以包含其它字符;\任意形如 xPATx 的字符串都可以获得“答案正确”,其中 x 或者是空字符串,或者是仅由字母 A 组成的字符串;\如果 aPbTc 是...原创 2018-06-29 18:44:40 · 121 阅读 · 0 评论 -
PAT甲级 1005 Spell It Right
1005 Spell It Right (20)(20 分)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 c...原创 2018-07-08 10:16:12 · 98 阅读 · 0 评论 -
PAT甲级 1006 Sign In and Sign Out
1006 Sign In and Sign Out (25)(25 分)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 re...原创 2018-07-08 10:19:21 · 172 阅读 · 0 评论 -
PAT(Basic Level) 1085 PAT单位排行
1085 PAT单位排行(25 分)每次 PAT 考试结束后,考试中心都会发布一个考生单位排行榜。本题就请你实现这个功能。输入格式:输入第一行给出一个正整数 N(≤105),即考生人数。随后 N 行,每行按下列格式给出一个考生的信息:准考证号 得分 学校其中准考证号是由 6 个字符组成的字符串,其首字母表示考试的级别:B代表乙级,A代表甲级,T代表顶级;得分是 [0, 100] 区间内的整...原创 2018-07-01 19:50:40 · 448 阅读 · 0 评论 -
PAT(Basic Level) 1002 写出这个数
读入一个自然数n,计算其各位数字之和,用汉语拼音写出和的每一位数字。输入格式:每个测试输入包含1个测试用例,即给出自然数n的值。这里保证n小于10^100^。输出格式:在一行内输出n的各位数字之和的每一位,拼音数字间有1 空格,但一行中最后一个拼音数字后没有空格。输入样例:1234567890987654321123456789输出样例:yi san wu解法一如...原创 2018-06-27 10:04:09 · 143 阅读 · 0 评论 -
PAT甲级 1001 A+B Format
1001 A+B Format (20)(20 分)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).Inp...原创 2018-07-02 11:15:52 · 169 阅读 · 0 评论 -
PAT甲级 1007 Maximum Subsequence Sum 动态规划DP
1007 Maximum Subsequence Sum (25)(25 分)Given a sequence of K integers { N~1~, N~2~, ..., N~K~ }. A continuous subsequence is defined to be { N~i~, N~i+1~, ..., N~j~ } where 1 <= i <= j <...原创 2018-07-09 11:07:33 · 220 阅读 · 0 评论 -
PAT甲级 1009 Product of Polynomials
1009 Product of Polynomials (25)(25 分)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, ...原创 2018-07-09 12:10:14 · 96 阅读 · 0 评论 -
PAT甲级 1002 A+B for Polynomials
This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomia...原创 2018-07-02 17:13:05 · 96 阅读 · 0 评论 -
PAT甲级 1003 Emergency
参考链接:点击打开链接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 c...原创 2018-07-03 21:16:26 · 307 阅读 · 0 评论 -
PAT甲级 1012 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 Algebra), and E - Eng...原创 2018-07-16 22:48:05 · 98 阅读 · 0 评论 -
PAT甲级 1010 Radix 二分查找
参考链接:点击打开链接题目大意为,给定数a和数b以及数a的进制,求数b的进制,使数a与数b相等。策略是采取二分查找法,确定的进制上下界中,查找一个进制,使其满足等式。进制的下界容易确定,必然为数b中最大符号代表的数加上1。进制的上界为数a表示的值加上1。1010 Radix (25)(25 分)Given a pair of positive integers, for exa...原创 2018-07-11 11:07:20 · 180 阅读 · 0 评论 -
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...原创 2018-07-23 11:41:58 · 133 阅读 · 0 评论 -
PAT甲级 1011 World Cup Betting
1011 World Cup Betting (20)(20 分)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 Wor...原创 2018-07-11 22:25:33 · 95 阅读 · 0 评论 -
PAT甲级 1004 Counting Leaves
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.InputEach input file contains one test case. Each case starts with a line contai...原创 2018-07-06 17:48:20 · 139 阅读 · 0 评论 -
PAT甲级 1013 Battle Over Cities (25) 统计连通图的个数
参考链接:https://www.liuchuo.net/archives/2346It 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 ar...原创 2018-07-19 11:20:08 · 145 阅读 · 0 评论 -
PAT甲级 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 day when the call is made. When...原创 2018-07-25 18:33:51 · 191 阅读 · 0 评论 -
PAT甲级 1017 Queueing at Bank (25)
参考链接:https://www.liuchuo.net/archives/2945Suppose 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 custome...原创 2018-07-27 09:32:07 · 125 阅读 · 0 评论 -
PAT甲级 1018.Public Bike Management (30)Dijkstra+DFS
参考链接:https://www.liuchuo.net/archives/23731018. 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. O...原创 2018-07-30 21:19:07 · 132 阅读 · 0 评论 -
PAT甲级 1014 Waiting in Line
参考链接:https://www.liuchuo.net/archives/2943Suppose 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 t...原创 2018-07-23 09:27:29 · 133 阅读 · 0 评论 -
PAT甲级 1022 Digital Library (30) map映射,set
1022 Digital Library(30 分)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 assigne...原创 2018-08-10 16:39:22 · 160 阅读 · 0 评论 -
PAT甲级 1019. General Palindromic Number
1019. General Palindromic Number (20)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 ...原创 2018-08-07 16:23:56 · 127 阅读 · 0 评论 -
PAT甲级 1020. Tree Traversals
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 tra...原创 2018-08-07 17:09:24 · 94 阅读 · 0 评论 -
PAT甲级 1023. Have Fun with Numbers (20) 大整数运算(利用字符串进行模拟)
参考链接:https://www.liuchuo.net/archives/2151Notice 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, whic...原创 2018-08-12 14:55:38 · 197 阅读 · 0 评论 -
PAT甲级 1024. Palindromic Number (25) 大整数相加(利用字符串模拟整数相加)
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 nu...原创 2018-08-12 22:31:48 · 227 阅读 · 0 评论 -
PAT甲级 1021. Deepest Root
1021. Deepest Root (25)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 hig...原创 2018-08-08 12:25:16 · 157 阅读 · 0 评论 -
PAT甲级 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 place...原创 2018-08-13 13:56:08 · 256 阅读 · 0 评论 -
PAT甲级 1029 Median(25 分)
1029 Median(25 分)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, ...原创 2018-08-27 17:31:42 · 134 阅读 · 0 评论 -
PAT 甲级 1034 Head of a Gang(30 分)图的遍历,DFS
One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is defined to be t...原创 2018-08-30 20:05:18 · 198 阅读 · 0 评论 -
PAT甲级 1036 Boys vs Girls(25 分)map,vector,排序
1036 Boys vs Girls(25 分)This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each...原创 2018-08-30 20:45:21 · 95 阅读 · 0 评论 -
PAT甲级 1037 Magic Coupon(25 分)贪心算法
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 th...原创 2018-08-30 22:30:02 · 336 阅读 · 0 评论 -
1027. Colors in Mars (20) 进制转换
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 are ...原创 2018-08-23 19:44:29 · 130 阅读 · 0 评论 -
PAT甲级 1030 Travel Plan(30 分)Dijkstra+DFS
1030 Travel Plan(30 分)A 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 to de...原创 2018-08-28 10:42:48 · 351 阅读 · 0 评论 -
PAT甲级 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 i...原创 2018-08-28 11:38:20 · 114 阅读 · 0 评论 -
PAT甲级 1038 Recover the Smallest Number(30 分)贪心算法,cmp和string的应用
1038 Recover the Smallest Number(30 分)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...原创 2018-08-31 11:09:54 · 167 阅读 · 0 评论 -
PAT甲级 1032 Sharing(25 分)链表(用数组模拟)
1032 Sharing(25 分)To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same ...原创 2018-08-28 20:05:11 · 209 阅读 · 0 评论 -
PAT甲级 1035 Password(20 分)字符串处理
1035 Password(20 分)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 distingui...原创 2018-08-29 19:20:13 · 143 阅读 · 0 评论 -
PAT甲级 1028 List Sorting(25 分)排序
1028 List Sorting(25 分)Excel can sort records according to any column. Now you are supposed to imitate this function.Input Specification:Each input file contains one test case. For each case, th...原创 2018-08-25 21:03:55 · 137 阅读 · 0 评论 -
C++ 通过reverse反转string字符串,判断是否是回文数
示例代码如下:#include<iostream>#include<algorithm> #include<string.h>using namespace std;int main(void){ string str = "1234321"; string s = str; reverse(s.begin(),s.end());//反转...原创 2018-09-01 19:54:53 · 1762 阅读 · 0 评论 -
PAT甲级 1039 Course List for Student(25 分)Hash散列
1039 Course List for Student(25 分)Zhejiang 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 cou...原创 2018-09-01 22:17:21 · 128 阅读 · 0 评论