![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT
多一些不为什么的坚持
qq:1216161552
展开
-
1060. 爱丁顿数(25)
1060. 爱丁顿数(25)时间限制250 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue英国天文学家爱丁顿很喜欢骑车。据说他为了炫耀自己的骑车功力,还定义了一个“爱丁顿数”E,即满足有E天骑车超过E原创 2016-11-29 20:09:04 · 338 阅读 · 0 评论 -
继续(3n+1)猜想 (25)
1005. 继续(3n+1)猜想 (25)时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里,情况稍微有些复杂。原创 2016-11-24 21:41:35 · 364 阅读 · 1 评论 -
数字黑洞 (20)
1019. 数字黑洞 (20)时间限制100 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue给定任一个各位数字不完全相同的4位正整数,如果我们先把4个数字按非递增排序,再按非递减排序,然后用第1个数字原创 2016-11-24 21:50:03 · 262 阅读 · 0 评论 -
月饼 (25)
1020. 月饼 (25)时间限制100 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue月饼是中国人在中秋佳节时吃的一种传统食品,不同地区有许多不同风味的月饼。现给定所有种类月饼的库存量、总售价、以及原创 2016-11-24 21:54:33 · 377 阅读 · 0 评论 -
组个最小数 (20)
1023. 组个最小数 (20)时间限制100 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CAO, Peng给定数字0-9各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意原创 2016-11-24 21:57:19 · 940 阅读 · 0 评论 -
科学计数法 (20)
1024. 科学计数法 (20)时间限制100 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者HOU, Qiming科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式[+-][1-9]"."[0-9]+E[+-][0-9]+,即数字的整数部分只有1位,小数部分至少有1位,该数字及其指数部分的正负号即使对正数也必定明确给出。原创 2016-11-24 22:01:06 · 533 阅读 · 0 评论 -
完美数列(25)
1030. 完美数列(25)时间限制300 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CAO, Peng给定一个正整数数列,和正整数p,设这个数列中的最大值是M,最小值是m,如果M 现在给定参数p和一些正整原创 2016-11-24 22:03:49 · 314 阅读 · 0 评论 -
到底买不买(20)
1039. 到底买不买(20)时间限制100 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue小红想买些珠子做一串自己喜欢的珠串。卖珠子的摊主有很多串五颜六色的珠串,但是不肯把任何一串拆散了卖。于是小红原创 2016-11-24 22:10:16 · 573 阅读 · 0 评论 -
有几个PAT(25)
1040. 有几个PAT(25)时间限制120 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CAO, Peng字符串APPAPT中包含了两个单词“PAT”,其中第一个PAT是第2位(P),第4位(A),第6位(T);原创 2016-11-24 22:17:36 · 288 阅读 · 0 评论 -
字符统计(20)
1042. 字符统计(20)时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue请编写程序,找出一段给定文字中出现最频繁的那个英文字母。输入格式:输入在一行中给出一个长度不超原创 2016-11-24 22:25:46 · 311 阅读 · 0 评论 -
火星数字(20)
1044. 火星数字(20)时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue火星人是以13进制计数的:地球人的0被火星人称为tret。地球人数字1到12的火星文分别为:j原创 2016-11-24 22:30:32 · 705 阅读 · 0 评论 -
5-12 功夫传人
一门武功能否传承久远并被发扬光大,是要看缘分的。一般来说,师傅传授给徒弟的武功总要打个折扣,于是越往后传,弟子们的功夫就越弱…… 直到某一支的某一代突然出现一个天分特别高的弟子(或者是吃到了灵丹、挖到了特别的秘笈),会将功夫的威力一下子放大N倍 —— 我们称这种弟子为“得道者”。这里我们来考察某一位祖师爷门下的徒子徒孙家谱:假设家谱中的每个人只有1位师傅(除了祖师爷没有师傅);每位师傅可以原创 2017-05-14 12:41:14 · 324 阅读 · 0 评论 -
L2-3 图着色问题
图着色问题是一个著名的NP完全问题。给定无向图G = (V, E)G=(V,E),问可否用KK种颜色为VV中的每一个顶点分配一种颜色,使得不会有两个相邻顶点具有同一种颜色?但本题并不是要你解决这个着色问题,而是对给定的一种颜色分配,请你判断这是否是图着色问题的一个解。输入格式:输入在第一行给出3个整数VV(0 0V≤500)、EE(\ge 0≥0)和KK(0 0原创 2017-05-14 15:18:46 · 1103 阅读 · 0 评论 -
5-14 周游世界(24分)
周游世界是件浪漫事,但规划旅行路线就不一定了…… 全世界有成千上万条航线、铁路线、大巴线,令人眼花缭乱。所以旅行社会选择部分运输公司组成联盟,每家公司提供一条线路,然后帮助客户规划由联盟内企业支持的旅行路线。本题就要求你帮旅行社实现一个自动规划路线的程序,使得对任何给定的起点和终点,可以找出最顺畅的路线。所谓“最顺畅”,首先是指中途经停站最少;如果经停站一样多,则取需要换乘线路次数最少的路线。原创 2017-05-14 17:02:45 · 1231 阅读 · 0 评论 -
L2-4 部落 (并查集)
在一个社区里,每个人都有自己的小圈子,还可能同时属于很多不同的朋友圈。我们认为朋友的朋友都算在一个部落里,于是要请你统计一下,在一个给定社区中,到底有多少个互不相交的部落?并且检查任意两个人是否属于同一个部落。输入格式:输入在第一行给出一个正整数NN(\le 10^4≤104),是已知小圈子的个数。随后NN行,每行按下列格式给出一个小圈子里的人:KK P[1]P[原创 2017-05-14 17:17:22 · 1644 阅读 · 0 评论 -
5-9 人以群分
社交网络中我们给每个人定义了一个“活跃度”,现希望根据这个指标把人群分为两大类,即外向型(outgoing,即活跃度高的)和内向型(introverted,即活跃度低的)。要求两类人群的规模尽可能接近,而他们的总活跃度差距尽可能拉开。输入格式:输入第一行给出一个正整数NN(2 \le N \le 10^52≤N≤105)。随后一行给出NN个正整数,分别是每个人的活跃度,其原创 2017-05-14 17:47:34 · 1226 阅读 · 0 评论 -
L2-1 点赞狂魔 (天梯赛决赛)
微博上有个“点赞”功能,你可以为你喜欢的博文点个赞表示支持。每篇博文都有一些刻画其特性的标签,而你点赞的博文的类型,也间接刻画了你的特性。然而有这么一种人,他们会通过给自己看到的一切内容点赞来狂刷存在感,这种人就被称为“点赞狂魔”。他们点赞的标签非常分散,无法体现出明显的特性。本题就要求你写个程序,通过统计每个人点赞的不同标签的数量,找出前3名点赞狂魔。输入格式:输入在第一行给出一原创 2017-05-15 18:29:32 · 1940 阅读 · 0 评论 -
1001. A+B Format (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).InputEach input file cont原创 2017-06-18 18:02:01 · 190 阅读 · 0 评论 -
1002. A+B for Polynomials (25)
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 p原创 2017-06-18 18:51:02 · 188 阅读 · 0 评论 -
1003. Emergency (25) <优先队列>
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 l原创 2017-06-07 18:03:41 · 291 阅读 · 0 评论 -
1005. Spell It Right (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 contains one test case.原创 2017-06-19 10:36:39 · 175 阅读 · 0 评论 -
九度 1099:后缀子串排序
题目描述:对于一个字符串,将其后缀子串进行排序,例如grain其子串有:grain rain ain in n然后对各子串按字典顺序排序,即: ain,grain,in,n,rain输入:每个案例为一行字符串。输出:将子串排序输出样例输入:grain样例输出:aingraininnrain原创 2017-06-22 18:31:11 · 414 阅读 · 0 评论 -
1021. Deepest Root (25) 并查集+BFS
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 highest tree. Such a root原创 2017-07-12 21:35:33 · 196 阅读 · 0 评论 -
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 assigned an unique 7-digit number a原创 2017-07-13 15:47:48 · 162 阅读 · 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原创 2017-07-13 16:11:03 · 181 阅读 · 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原创 2017-07-13 17:07:41 · 164 阅读 · 0 评论 -
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 places, and the ranklists w原创 2017-07-16 14:06:21 · 126 阅读 · 0 评论 -
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 for Red, the middle 2 dig原创 2017-07-16 14:29:32 · 139 阅读 · 0 评论 -
1028. List Sorting (25)
Excel can sort records according to any column. Now you are supposed to imitate this function.InputEach input file contains one test case. For each case, the first line contains two integers N原创 2017-07-16 14:53:37 · 136 阅读 · 0 评论 -
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, 10, 15, 16, 17} is 15. The原创 2017-07-16 15:27:07 · 148 阅读 · 0 评论 -
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 decide the shortest path b原创 2017-07-16 16:40:05 · 175 阅读 · 0 评论 -
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 is, the characters must be pr原创 2017-07-17 11:38:34 · 287 阅读 · 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原创 2017-07-29 15:06:28 · 154 阅读 · 0 评论 -
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原创 2017-07-29 15:50:48 · 213 阅读 · 0 评论 -
1099. Build A Binary Search Tree (30) <BST树>
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原创 2017-07-29 17:49:53 · 339 阅读 · 0 评论 -
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 suffix. For example,原创 2017-07-17 12:11:01 · 168 阅读 · 0 评论 -
1034. Head of a Gang (30) <广搜>
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原创 2017-07-17 14:19:52 · 164 阅读 · 0 评论 -
1100. Mars Numbers (20)<map>
People on Mars count their numbers with base 13:Zero on Earth is called "tret" on Mars.The numbers 1 to 12 on Earch is called "jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec" on Ma原创 2017-07-29 18:15:27 · 199 阅读 · 0 评论 -
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 distinguish 1 (one) from l (L原创 2017-07-17 18:14:38 · 143 阅读 · 0 评论 -
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 input file contains o原创 2017-07-17 18:26:43 · 183 阅读 · 0 评论