PAT
文章平均质量分 68
曾是惊鸿照影来。
Missヾaurora
想将岁月凝结成诗,却没想过,有一天,这诗也会渐渐老去,以致后来,无人问津。
展开
-
PAT甲级【 A1003 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 city and the length of each road between any pair of cities ar原创 2021-07-07 21:28:21 · 103 阅读 · 0 评论 -
PAT甲级【 A1076 Forwards on Weibo 】
题目描述Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a post on Weibo, all his/her followe原创 2021-06-29 20:54:58 · 128 阅读 · 0 评论 -
PAT甲级【 A1043 Is It a Binary Search Tree 】
题目描述A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node’s key.The right subtree of a node contains only nodes with keys greate原创 2021-06-09 16:16:03 · 126 阅读 · 0 评论 -
PAT甲级【 A1053 Path of Equal Weight 】
题目描述Given a non-empty tree with root R, and with weight Wiassigned to each tree node Ti. The weight of a path from R to Lis defined to be the sum of the weights of all the nodes along the pathfrom R to any leaf node L.Now given any weighted tree, y原创 2021-06-05 19:58:06 · 147 阅读 · 0 评论 -
PAT甲级【 A1020 Tree Traversals】
题目描述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 traversal sequence of the corresponding binary tree.输入描述Each input file co原创 2021-06-02 21:39:44 · 107 阅读 · 0 评论 -
PAT甲级【 A1060 Are They Equal】
题目描述If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123*105 with simple chopping. Now given the number of significant digits on a machine and two float numbers, you原创 2021-05-17 21:29:14 · 148 阅读 · 0 评论 -
PAT甲级【 A1059 Prime Factors】
题目描述Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1 * p2^k2 *…*pm^km.输入描述Each input file contains one test case which gives a positive integer N in the range of long int.输出描述原创 2021-05-04 11:01:14 · 122 阅读 · 0 评论 -
【PAT B1013】数素数
题目描述令Pi表示第i个素数。现任给两个正整数M <= N <= 10000,请输出PM到PN的所有素数。输入描述输入在一行中给出M和N,其间以空格分隔。输出描述输出从PM到PN的所有素数,每10个数字占1行,其间以空格分隔,但行末不得有多余空格。输入样例5 27输出样例11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103分析由于题目只说是素数最多不超过104,因此原创 2021-05-01 19:48:08 · 172 阅读 · 0 评论 -
PAT甲级 【 A1069 The Black Hole of Numbers】
题目描述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 taking the second number from the first one. Repeat in原创 2021-04-26 18:40:35 · 101 阅读 · 0 评论 -
PAT甲级 【 A1093 Count PAT’s】
题目描述字符串APPAPT中包含了两个单词“PAT”,其中第一个PAT是第2位§,第4位(A),第6位(T);第二个PAT是第3位§,第4位(A),第6位(T)。现给定字符串,问一共可以形成多少个PAT?输入描述:输入只有一行,包含一个字符串,长度不超过105,只包含P、A、T三种字母。输出描述:在一行中输出给定字符串中包含多少个PAT。由于结果可能比较大,只输出对1000000007取余数的结果。输入样例:APPAPT输出样例:2分析1对于每一个A,求出其前面原创 2021-04-09 21:05:59 · 121 阅读 · 0 评论 -
PAT甲级【 A1052 Linked List Sorting】
题目描述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 the st原创 2021-03-22 19:51:13 · 72 阅读 · 0 评论 -
PAT甲级【 A1032 Sharing】
题目描述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 suffix. For example, loading and being are stored as showed in Figure原创 2021-03-21 16:51:46 · 140 阅读 · 0 评论 -
PAT甲级【 A1025 PAT Ranking】
题目描述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 places, and the ranklists will be merged immediately after the test. Now it i原创 2021-03-07 21:16:57 · 126 阅读 · 0 评论 -
【PAT B1009】说反话
题目描述给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过 80 的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用 1 个空格分开,输入保证句子末尾没有多余的空格。输出格式:每个测试用例的输出占一行,输出倒序后的句子。输入样例:Hello World Here I Come输出样例:Come I Here World Hello分析:用get原创 2021-03-04 20:58:55 · 82 阅读 · 1 评论 -
【PAT B1022】D进制的A+B
系列文章目录提示:这里可以添加系列文章的所有文章的目录,目录需要自己手动添加例如:第一章 Python 机器学习入门之pandas的使用提示:写完文章后,目录可以自动生成,如何生成可参考右边的帮助文档文章目录系列文章目录前言一、pandas是什么?二、使用步骤1.引入库2.读入数据总结前言提示:这里可以添加本文要记录的大概内容:例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。提示:以下是本篇文章正文内容,下面案例原创 2021-03-04 16:58:53 · 135 阅读 · 1 评论 -
【PAT B1036】跟奥巴马一起编程
题目描述美国总统奥巴马不仅呼吁所有人都学习编程,甚至以身作则编写代码,成为美国历史上首位编写计算机代码的总统。2014 年底,为庆祝“计算机科学教育周”正式启动,奥巴马编写了很简单的计算机代码:在屏幕上画一个正方形。现在你也跟他一起画吧!输入格式:输入在一行中给出正方形边长 N(3≤N≤20)和组成正方形边的某种字符 C,间隔一个空格。输出格式:输出由给定字符 C 画出的正方形。但是注意到行间距比列间距大,所以为了让结果看上去更像正方形,我们输出的行数实际上是列数的 50%(四舍五入取整原创 2021-03-01 19:55:37 · 299 阅读 · 0 评论 -
【PAT B1032】挖掘机技术哪家强
题目描述卡拉兹猜想对任何一个正整数 n,如果它是偶数,那么把它砍掉一半;如果它是数,那么把 (3n+1) 砍掉一半。这样一直反复砍下去,最后一定在某一步得到n=1。卡拉兹在 1950年的世界数学家大会上公布了这个猜想,传说当时耶鲁大学师生齐动员,拼命想证明这个貌似很傻很天真的命题,结果闹得学生们无心学业,一心只证(3n+1),以至于有人说这是一个阴谋,卡拉兹是在蓄意延缓美国数学界教学与科研的进展……我们今天的题目不是证明卡拉兹猜想,而是对给定的任一不超过 1000 的正整数 n,简单地数一下,需要多原创 2021-03-01 14:44:19 · 90 阅读 · 0 评论 -
【PAT B1001】害死人不偿命的3n+1猜想
题目描述卡拉兹(Callatz)猜想:对任何一个正整数 n,如果它是偶数,那么把它砍掉一半;如果它是奇数,那么把 (3n+1) 砍掉一半。这样一直反复砍下去,最后一定在某一步得到 n=1。卡拉兹在 1950 年的世界数学家大会上公布了这个猜想,传说当时耶鲁大学师生齐动员,拼命想证明这个貌似很傻很天真的命题,结果闹得学生们无心学业,一心只证 (3n+1),以至于有人说这是一个阴谋,卡拉兹是在蓄意延缓美国数学界教学与科研的进展……我们今天的题目不是证明卡拉兹猜想,而是对给定的任一不超过 1000 的正整数原创 2021-02-28 20:55:14 · 97 阅读 · 0 评论