PAT甲级1046~1050|C++实现

PAT甲级1046 Shortest Distance (20分)|C++实现PAT甲级1047 Student List for Course (25分)|C++实现PAT甲级1048 Find Coins (25分)|C++实现PAT甲级1049 Counting Ones (30分)|C++实现PAT甲级1050 String Subtraction (20分)|C++实现
分类: 其他 发布时间: 09-23 12:26 阅读次数: 0

PAT甲级1051 Pop Sequence (25分)|C++实现

一、题目描述原题链接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 possible pop sequence of the stack. For example, if M is 5 and N is 7, w
分类: 其他 发布时间: 09-23 12:26 阅读次数: 0

PAT甲级1052 Linked List Sorting (25分)|C++实现

一、题目描述原题链接A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now given a linked list, you are supposed to sort th
分类: 其他 发布时间: 09-23 12:26 阅读次数: 0

PAT甲级1053 Path of Equal Weight (30分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:Sample Input:20 9 2410 2 4 3 5 10 2 18 9 7 2 2 1 3 12 1 8 6 2 200 4 01 02 03 0402 1 0504 2 06 0703 3 11 12 1306 1 0907 2 08 1016 1 1513 3 14 16 1717 2 18 19Sample Output:10 5 2 710 4
分类: 其他 发布时间: 09-23 12:26 阅读次数: 0

PAT甲级1054 The Dominant Color (20分)|C++实现

一、题目描述原题链接Behind the scenes in the computer’s memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called the dominant color. A strictly dominant color tak
分类: 其他 发布时间: 09-23 12:26 阅读次数: 0

PAT甲级1055 The World‘s Richest (25分)|C++实现

一、题目描述原题链接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 people in a certain range of ages. That is, given
分类: 其他 发布时间: 09-23 12:26 阅读次数: 0

PAT甲级1051~1055|C++实现

PAT甲级1051 Pop Sequence (25分)|C++实现PAT甲级1052 Linked List Sorting (25分)|C++实现PAT甲级1053 Path of Equal Weight (30分)|C++实现PAT甲级1054 The Dominant Color (20分)|C++实现PAT甲级1055 The World‘s Richest (25分)|C++实现
分类: 其他 发布时间: 09-23 12:26 阅读次数: 0

PAT甲级1056 Mice and Rice (25分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:Sample Input:11 325 18 0 46 37 3 19 22 57 56 106 0 8 7 10 5 9 1 4 2 3Sample Output:5 5 5 2 5 5 5 3 1 3 5二、解题思路运用了队列的题目。进行输入时,我们把输入的比赛顺序存放在一个队列中,需要注意的是,以样例为例,我们前三个输入的6,0,8,意思是6号、0号和8号选手先进行比赛
分类: 其他 发布时间: 09-23 12:26 阅读次数: 0

PAT甲级1057 Stack (30分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:Sample Input:17PopPeekMedianPush 3PeekMedianPush 2PeekMedianPush 1PeekMedianPopPopPush 5Push 4PeekMedianPopPopPopPopSample Output:InvalidInvalid322124453Invalid二、解题
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1058 A+B in Hogwarts (20分)|C++实现

一、题目描述原题链接Input Specification:Each input file contains one test case which occupies a line with A and B in the standard form, separated by one space.​​Output Specification:For each test case you should output the sum of A and B in one line, with the
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1059 Prime Factors (25分)|C++实现

一、题目描述原题链接Input Specification:Each input file contains one test case which gives a positive integer N in the range of long int.​​Output Specification:Sample Input:97532468Sample Output:97532468=22∗11∗17∗101∗12912^2*11*17*101*129122∗11∗17∗101∗1291
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1060 Are They Equal (25分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:Sample Input 1:3 12300 12358.9Sample Output 1:YES 0.123*10^5Sample Input 2:3 120 128Sample Output 2:NO 0.120*10^3 0.128*10^3二、解题思路稍微有点复杂的字符串处理题,只要把握好数字标准形式的变化规律,还是很容易做出来的,这道题有一个小坑,就是前导0要消
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1056~1060|C++实现

PAT甲级1056 Mice and Rice (25分)|C++实现PAT甲级1057 Stack (30分)|C++实现PAT甲级1058 A+B in Hogwarts (20分)|C++实现PAT甲级1059 Prime Factors (25分)|C++实现PAT甲级1060 Are They Equal (25分)|C++实现
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1061 Dating (20分)|C++实现

一、题目描述原题链接Input Specification:Each input file contains one test case. Each case gives 4 non-empty strings of no more than 60 characters without white space in 4 lines.​​Output Specification:For each test case, print the decoded time in one line, in t
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1062 Talent and Virtue (25分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:Sample Input:14 60 8010000001 64 9010000002 90 6010000011 85 8010000003 85 8010000004 80 8510000005 82 7710000006 83 7610000007 90 7810000008 75 7910000009 59 9010000010 88 4510000012
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1063 Set Similarity (25分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:For each query, print in one line the similarity of the sets, in the percentage form accurate up to 1 decimal place.Sample Input:33 99 87 1014 87 101 5 877 99 101 18 5 135 18 9921 21 3Samp
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1064 Complete Binary Search Tree (30分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:Sample Input:101 2 3 4 5 6 7 8 9 0Sample Output:6 3 8 1 5 7 9 0 2 4二、解题思路完全二叉搜索树的中序遍历转层序遍历,如果按照平常的建立二叉搜索树的做法就很复杂了,而且也没有有效利用题目的条件。二叉搜索树的中序遍历一定是按元素从小到大排的,那么第一个元素一定是在二叉树的左下角,第二个元素则是它的父亲节点,第三个元素
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1065 A+B and C (64bit) (20分)|C++实现

一、题目描述原题链接Input Specification:​​Output Specification:Sample Input:31 2 32 3 49223372036854775807 -9223372036854775808 0Sample Output:Case #1: falseCase #2: trueCase #3: false二、解题思路这道题取了个巧,直接用long double存储数据,更科学的方法可以去参考柳神的解答,好像要重载大于号…三、AC代
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1061~1065|C++实现

PAT甲级1061 Dating (20分)|C++实现PAT甲级1062 Talent and Virtue (25分)|C++实现PAT甲级1063 Set Similarity (25分)|C++实现PAT甲级1064 Complete Binary Search Tree (30分)|C++实现PAT甲级1065 A+B and C (64bit) (20分)|C++实现
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0

PAT甲级1066 Root of AVL Tree (25分)|C++实现

一、题目描述原题链接Input Specification:Each input file contains one test case. For each case, the first line contains a positive integer N (≤20) which is the total number of keys to be inserted. Then N distinct integer keys are given in the next line. All the n
分类: 其他 发布时间: 09-23 12:25 阅读次数: 0