自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 收藏
  • 关注

原创 10-排序4 统计工龄 (20分) c语言实现

给定公司N名员工的工龄,要求按工龄增序输出每个工龄段有多少员工。输入格式:输入首先给出正整数N(≤10​5​​ ),即员工总人数;随后给出N个整数,即每个员工的工龄,范围在[0, 50]。输出格式:按工龄的递增顺序输出每个工龄的员工个数,格式为:“工龄:人数”。每项占一行。如果人数为0则不输出该项。输入样例:810 2 0 5 7 2 5 2输出样例:0:12:35:27:110:1具体思路很简单的快速排序具体代码#include<stdio.h>#inc

2020-08-09 11:50:41 907

原创 PAT 甲级真题 1038 Recover the Smallest Number (30分) python实现

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 many numbers such like 32-321-3214-0229-87 or 0229-32-87-321-3214 with respect to different ord

2020-08-07 13:09:59 212

原创 PAT 1019 General Palindromic Number (20分) python实现

向前或向后写入时相同的数字称为回文数。例如,1234321是回文数。所有单数数字都是回文数字。虽然回文数在十进制中最常被考虑,但回文性的概念可以适用于任何数字系统中的自然数。考虑基b≥2中的一个数字N>0,其中它是用标准表示法编写的,用k+1位数字(​i​​)作为∑​i=0​k​​(​i​​b​i​​)。在这里,和往常一样,0≤a​i​​<b对于所有i和​k​​是非零的。然后N是回文的当且仅当​i​​=a​k−i​​对于所有i.0在任何基中都是0,并且定义上也是回文的。给定任何正十进制整数N和基

2020-08-04 16:26:04 168

原创 09-排序2 Insert or Merge (25分) c语言实现

According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, an

2020-08-03 11:58:08 239

原创 PTA 09-排序3 Insertion or Heap Sort (25分) C语言实现

According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, an

2020-08-03 10:28:51 249

原创 pat 09-排序1 排序 (25point(s)) c语言

给定N个(长整型范围内的)整数,要求输出从小到大排序后的结果。本题旨在测试各种不同的排序算法在各种数据情况下的表现。各组测试数据特点如下:数据1:只有1个元素;数据2:11个不相同的整数,测试基本正确性;数据3:103个随机整数;数据4:104个随机整数;数据5:105个随机整数;数据6:105个顺序整数;数据7:105个逆序整数;数据8:105个基本有序的整数;数据9:105个随机正整数,每个数字不超过1000。输入格式:输入第一行给出正整数N(≤10​5​​ ),随后一行给出

2020-08-01 13:24:34 284

原创 PTA 08-图8 How Long Does It Take (25分) c语言实现

Given the relations of all the activities of a project, you are supposed to find the earliest completion time of the project.Input Specification:Each input file contains one test case. Each case starts with a line containing two positive integers N (≤100

2020-07-26 11:18:45 298

原创 PTA 08-图7 公路村村通 (30point(s)) c语言实现

公路村村通现有村落间道路的统计数据表中,列出了有可能建设成标准公路的若干条道路的成本,求使每个村落都有公路连通所需要的最低成本。输入格式:输入数据包括城镇数目正整数N(≤1000)和候选道路数目M(≤3N);随后的M行对应M条道路,每行给出3个正整数,分别是该条道路直接连通的两个城镇的编号以及该道路改建的预算成本。为简单起见,城镇从1到N编号。输出格式:输出村村通需要的最低成本。如果输入数据不足以保证畅通,则输出−1,表示需要建设更多公路。输入样例:6 151 2 51 3 31 4 7

2020-07-25 17:16:15 592

原创 PAT 甲级真题 1006 Sign In and Sign Out (25分) python实现

1006 Sign In and Sign Out (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 records of signing in’s and out’s, you are supposed to find th

2020-07-24 16:41:45 189

原创 PAT 甲级真题 1003 Emergency (25分) c语言实现

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 length of each road between any pair

2020-07-24 15:22:18 458

原创 pta 07-图6 旅游规划 (25分) c语言实现

07-图6 旅游规划 (25分)有了一张自驾旅游路线图,你会知道城市间的高速公路长度、以及该公路要收取的过路费。现在需要你写一个程序,帮助前来咨询的游客找一条出发地和目的地之间的最短路径。如果有若干条路径都是最短的,那么需要输出最便宜的一条路径。输入格式:输入说明:输入数据的第1行给出4个正整数N、M、S、D,其中N(2≤N≤500)是城市的个数,顺便假设城市的编号为0~(N−1);M是高速公路的条数;S是出发地的城市编号;D是目的地的城市编号。随后的M行中,每行给出一条高速公路的信息,分别是:城市1

2020-07-22 10:26:13 1121

原创 PTA 07-图4 哈利·波特的考试 (25分)

具体要求哈利·波特要考试了,他需要你的帮助。这门课学的是用魔咒将一种动物变成另一种动物的本事。例如将猫变成老鼠的魔咒是haha,将老鼠变成鱼的魔咒是hehe等等。反方向变化的魔咒就是简单地将原来的魔咒倒过来念,例如ahah可以将老鼠变成猫。另外,如果想把猫变成鱼,可以通过念一个直接魔咒lalala,也可以将猫变老鼠、老鼠变鱼的魔咒连起来念:hahahehe。现在哈利·波特的手里有一本教材,里面列出了所有的变形魔咒和能变的动物。老师允许他自己带一只动物去考场,要考察他把这只动物变成任意一只指定动物的本事。

2020-07-21 11:15:58 285

原创 PAT 1005 Spell It Right (20分) python实现

具体要求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. Each case occupies one line which contains an N (≤10​10

2020-07-15 21:41:57 139

原创 PAT 1002 A+B for Polynomials (25分) c语言实现

具体要求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, and each line contains the information of a polynomial:where K is the number of nonzer

2020-07-15 17:05:08 193

原创 PAT 1001 A+B Format (20分) C语言实现

具体要求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).Input Specification:Each input file contains one test case. Each case contains a pair

2020-07-14 15:44:13 222

原创 pta 06-图2 Saving James Bond - Easy Version (25分) C语言实现

基本题意This time let us consider the situation in the movie “Live and Let Die” in which James Bond, the world’s most famous spy, was captured by a group of drug dealers. He was sent to a small piece of land at the center of a lake filled with crocodiles. The

2020-07-13 16:40:39 426 3

原创 pta 06-图1 列出连通集 (25分) c语言实现

## pta 06-图1 列出连通集给定一个有N个顶点和E条边的无向图,请用DFS和BFS分别列出其所有的连通集。假设顶点从0到N−1编号。进行搜索时,假设我们总是从编号最小的顶点出发,按编号递增的顺序访问邻接点。输入格式:输入第1行给出2个整数N(0<N≤10)和E,分别是图的顶点数和边数。随后E行,每行给出一条边的两个端点。每行中的数字之间用1空格分隔。输出格式:按照"{ v​1​​ v​2… v​k}"的格式,每行输出一个连通集。先...

2020-07-13 13:44:16 635

原创 pta 05-树8 File Transfer (25分) c语言实现

提交图:不了解并查集的百度下,不过这个不是典型的并查集吧。具体代码:#include<stdio.h>#include<string.h>#include<stdlib.h>#define MAX 100001typedef struct Node{ int flag; /*标记数,用来区分是否是一个集合里面的*/ int data;}BINCHA;BINCHA h[MAX];int da(int x,int y){

2020-07-10 13:15:30 233 2

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除