自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(56)
  • 问答 (1)
  • 收藏
  • 关注

原创 1036 Boys vs Girls (25分)

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 in...

2020-03-31 19:36:20 57

原创 1006 Sign In and Sign Out (25分)

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 record...

2020-03-31 18:37:41 50

原创 1073 Scientific Notation (20分)

1073 Scientific Notation (20分)Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [±][1-9].[0-9]+E[±][0-...

2020-03-31 16:51:54 51

原创 1069 The Black Hole of Numbers (20分)

1069 The Black Hole of Numbers (20分)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, ...

2020-03-31 16:33:56 57

原创 1065 A+B and C (64bit) (20分)

1065 A+B and C (64bit) (20分)Given three integers A, B and C in [−2​^63​​ ,2 ^63​​ ], you are supposed to tell whether A+B>C.Input Specification:The first line of the input gives the positive num...

2020-03-31 00:32:23 81

原创 1061 Dating (20分)

1061 Dating (20分)Sherlock Holmes received a note with some strange strings: Let’s date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm. It took him only a minute to figure out that tho...

2020-03-30 21:26:47 79

原创 1058 A+B in Hogwarts (20分)

1058 A+B in Hogwarts (20分)If you are a fan of Harry Potter, you would know the world of magic has its own currency system – as Hagrid explained it to Harry, “Seventeen silver Sickles to a Galleon and...

2020-03-30 20:35:12 88

原创 1050 String Subtraction (20分)

1050 String Subtraction (20分)Given two strings S​1​​ and S2​​ , S=S​1​​ −S​2​​ is defined to be the remaining string after taking all the characters in S​2​​ from S​1​​ . Your task is simply to ca...

2020-03-30 17:02:01 54

原创 1046 Shortest Distance (20分) (含测试点2分析)

1046 Shortest Distance (20分)The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specifica...

2020-03-30 16:55:16 244

原创 1042 Shuffling Machine (20分)

1042 Shuffling Machine (20分)Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid “inside jobs” where emplo...

2020-03-30 11:48:46 41

原创 1041 Be Unique (20分)

1041 Be Unique (20分)Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,10​ ^4​​ ]. ...

2020-03-30 10:22:22 44

原创 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 distinguis...

2020-03-30 10:10:13 98

原创 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 is, t...

2020-03-30 00:31:15 92

原创 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...

2020-03-30 00:09:04 56

原创 1023 Have Fun with Numbers (20分)

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...

2020-03-29 23:57:17 54

原创 1019 General Palindromic Number (20分)

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...

2020-03-29 22:01:10 83

原创 1015 Reversible Primes (20分)

1015 Reversible Primes (20分)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 becaus...

2020-03-29 21:49:58 46

原创 1011 World Cup Betting (20分)

1011 World Cup Betting (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 World C...

2020-03-29 21:29:14 72

原创 1008 Elevator (20分)

1008 Elevator (20分)The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified o...

2020-03-29 13:25:12 51

原创 1005 Spell It Right (20分)

1005 Spell It RightGiven 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 ...

2020-03-29 13:19:39 63

原创 1002 A+B for Polynomials

1002 A+B for PolynomialsThis 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 li...

2020-03-29 00:20:51 57

原创 1001 A+B Format

1001 A+B FormatCalculate 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...

2020-03-29 00:05:42 60

原创 2.五子棋

2.五子棋小 A 和小 B 在下五子棋。五子棋是在一个由网格构成的棋盘内进行的。网格有 15 行 15 列,共有 225 个交叉点。小 A 先手执黑棋,小 B 后手执白棋。两人轮流下棋,每次下棋都将一个自己的棋子放在棋盘上一个空白的交叉点上。然而,由于小 A 和小 B 都不知道五子棋的胜利条件,所以即使有一方已经胜利了,他们仍然会继续下棋。现在想请你帮忙分析一下,所下的棋局是在第几步...

2020-03-28 23:07:07 408 1

原创 1.出现

1.出现给定 n 个自然数,求没有在这 n 个自然数中出现过的最小的自然数是多少。注意,0 也是自然数。输入格式第一行输入一个正整数 n。第二行输入给定的 n 个自然数,相邻两个自然数之间用一个空格隔开。输出格式输出只有一行,一个自然数,表示没有在输入的 n 个自然数中出现过的最小的自然数。数据范围1≤n≤1000,输入的 n 个自然数都不大于 1000。输入样例1:72...

2020-03-28 21:55:17 464 1

原创 1075 链表元素分类

1075 链表元素分类给定一个单链表,请编写程序将链表元素进行分类排列,使得所有负值元素都排在非负值元素的前面,而 [0, K] 区间内的元素都排在大于 K 的元素前面。但每一类内部元素的顺序是不能改变的。例如:给定链表为 18→7→-4→0→5→-6→10→11→-2,K 为 10,则输出应该为 -4→-6→-2→7→0→5→10→18→11。输入格式:每个输入包含一个测试用例。每个测试用...

2020-03-28 10:26:07 91

原创 1034 有理数四则运算

1034 有理数四则运算本题要求编写程序,计算 2 个有理数的和、差、积、商。输入格式:输入在一行中按照 a1/b1 a2/b2 的格式给出两个分数形式的有理数,其中分子和分母全是整型范围内的整数,负号只可能出现在分子前,分母不为 0。输出格式:分别在 4 行中按照 有理数1 运算符 有理数2 = 结果 的格式顺序输出 2 个有理数的和、差、积、商。注意输出的每个有理数必须是该有理数的最...

2020-03-28 00:36:26 125

原创 1073 多选题常见计分法

1073 多选题常见计分法批改多选题是比较麻烦的事情,有很多不同的计分方法。有一种最常见的计分方法是:如果考生选择了部分正确选项,并且没有选择任何错误选项,则得到 50% 分数;如果考生选择了任何一个错误的选项,则不能得分。本题就请你写个程序帮助老师批改多选题,并且指出哪道题的哪个选项错的人最多。输入格式:输入在第一行给出两个正整数 N(≤1000)和 M(≤100),分别是学生人数和多选题...

2020-03-26 21:04:44 148

原创 1058 选择题(含测试点1分析)

1058 选择题批改多选题是比较麻烦的事情,本题就请你写个程序帮助老师批改多选题,并且指出哪道题错的人最多。输入格式:输入在第一行给出两个正整数 N(≤ 1000)和 M(≤ 100),分别是学生人数和多选题的个数。随后 M 行,每行顺次给出一道题的满分值(不超过 5 的正整数)、选项个数(不少于 2 且不超过 5 的正整数)、正确选项个数(不超过选项个数的正整数)、所有正确选项。注意每题的...

2020-03-26 12:33:18 737

原创 1055 集体照

1055 集体照拍集体照时队形很重要,这里对给定的 N 个人 K 排的队形设计排队规则如下:每排人数为 N/K(向下取整),多出来的人全部站在最后一排;后排所有人的个子都不比前排任何人矮;每排中最高者站中间(中间位置为 m/2+1,其中 m 为该排人数,除法向下取整);每排其他人以中间人为轴,按身高非增序,先右后左交替入队站在中间人的两侧(例如5人身高为190、188、186、175、1...

2020-03-26 09:50:44 136

原创 1089 狼人杀-简单版

1089 狼人杀-简单版以下文字摘自《灵机一动·好玩的数学》:“狼人杀”游戏分为狼人、好人两大阵营。在一局“狼人杀”游戏中,1 号玩家说:“2 号是狼人”,2 号玩家说:“3 号是好人”,3 号玩家说:“4 号是狼人”,4 号玩家说:“5 号是好人”,5 号玩家说:“4 号是好人”。已知这 5 名玩家中有 2 人扮演狼人角色,有 2 人说的不是实话,有狼人撒谎但并不是所有狼人都在撒谎。扮演狼人角...

2020-03-24 21:24:36 82

原创 1025 反转链表

1025 反转链表给定一个常数 K 以及一个单链表 L,请编写程序将 L 中每 K 个结点反转。例如:给定 L 为 1→2→3→4→5→6,K 为 3,则输出应该为 3→2→1→6→5→4;如果 K 为 4,则输出应该为 4→3→2→1→5→6,即最后不到 K 个元素不反转。输入格式:每个输入包含 1 个测试用例。每个测试用例第 1 行给出第 1 个结点的地址、结点总个数正整数 N (≤10...

2020-03-23 21:53:18 129

原创 1079 延迟的回文数

1079 延迟的回文数给定一个 k+1 位的正整数 N,写成 a​k​​ ⋯a​1​​ a​0​​ 的形式,其中对所有 i 有 0≤a​i​​ <10 且 a​k​​ >0。N 被称为一个回文数,当且仅当对所有 i 有 a​i​​ =a​k−i​​ 。零也被定义为一个回文数。非回文数也可以通过一系列操作变出回文数。首先将该数字逆转,再将逆转数与该数相加,如果和还不是一个回文数,就...

2020-03-22 11:04:41 162

原创 1095 解码准考证

1095 解码准考证PAT 准考证号由 4 部分组成:第 1 位是级别,即 T 代表顶级;A 代表甲级;B 代表乙级;第 2~4 位是考场编号,范围从 101 到 999;第 5~10 位是考试日期,格式为年、月、日顺次各占 2 位;最后 11~13 位是考生编号,范围从 000 到 999。现给定一系列考生的准考证号和他们的成绩,请你按照要求输出各种统计信息。输入格式:输入首先在...

2020-03-22 00:53:18 170

原创 1085 PAT单位排行

1085 PAT单位排行每次 PAT 考试结束后,考试中心都会发布一个考生单位排行榜。本题就请你实现这个功能。输入格式:输入第一行给出一个正整数 N(≤10^​5​​ ),即考生人数。随后 N 行,每行按下列格式给出一个考生的信息:准考证号 得分 学校其中准考证号是由 6 个字符组成的字符串,其首字母表示考试的级别:B代表乙级,A代表甲级,T代表顶级;得分是 [0, 100] 区间内的整...

2020-03-21 00:02:23 94

原创 1068 万绿丛中一点红

1068 万绿丛中一点红对于计算机而言,颜色不过是像素点对应的一个 24 位的数值。现给定一幅分辨率为 M×N 的画,要求你找出万绿丛中的一点红,即有独一无二颜色的那个像素点,并且该点的颜色与其周围 8 个相邻像素的颜色差充分大。输入格式:输入第一行给出三个正整数,分别是 M 和 N(≤ 1000),即图像的分辨率;以及 TOL,是所求像素点与相邻点的颜色差阈值,色差超过 TOL 的点才被考...

2020-03-20 23:20:11 65

原创 1062 最简分数(含测试点1问题)

1062 最简分数一个分数一般写成两个整数相除的形式:N/M,其中 M 不为0。最简分数是指分子和分母没有公约数的分数表示形式。现给定两个不相等的正分数 N​1​​ /M​1​​ 和 N​2​​ /M​2​​ ,要求你按从小到大的顺序列出它们之间分母为 K 的最简分数。输入格式:输入在一行中按 N/M 的格式给出两个正分数,随后是一个正整数分母 K,其间以空格分隔。题目保证给出的所有整数...

2020-03-20 16:13:57 601

原创 1060 爱丁顿数

1060 爱丁顿数英国天文学家爱丁顿很喜欢骑车。据说他为了炫耀自己的骑车功力,还定义了一个“爱丁顿数” E ,即满足有 E 天骑车超过 E 英里的最大整数 E。据说爱丁顿自己的 E 等于87。现给定某人 N 天的骑车距离,请你算出对应的爱丁顿数 E(≤N)。输入格式:输入第一行给出一个正整数 N (≤10^​5​​ ),即连续骑车的天数;第二行给出 N 个非负整数,代表每天的骑车距离。输...

2020-03-20 15:46:58 94

原创 sscanf和sprintf用法详解

sscanf函数头文件 iostream里,sscanf具有从字符串中取出整数,浮点数,和字符串等功能;sscanf将str字符串以format格式进行转换,并将转换的结果存于对应的参数内。sscanf定义:int sscanf (const char *str, const char * format,…);返回值:成功则返回参数数目;失败则返回-1;例如:sscanf(str...

2020-03-20 12:12:38 488

原创 1054 求平均值

1054 求平均值本题的基本要求非常简单:给定 N 个实数,计算它们的平均值。但复杂的是有些输入数据可能是非法的。一个“合法”的输入是 [−1000,1000] 区间内的实数,并且最多精确到小数点后 2 位。当你计算平均值的时候,不能把那些非法的数据算在内。输入格式:输入第一行给出正整数 N(≤100)。随后一行给出 N 个实数,数字间以一个空格分隔。输出格式:对每个非法输入,在一行中输...

2020-03-20 09:32:28 193 1

原创 1050 螺旋矩阵

1050 螺旋矩阵本题要求将给定的 N 个正整数按非递增的顺序,填入“螺旋矩阵”。所谓“螺旋矩阵”,是指从左上角第 1 个格子开始,按顺时针螺旋方向填充。要求矩阵的规模为 m 行 n 列,满足条件:m×n 等于 N;m≥n;且 m−n 取所有可能值中的最小值。输入格式:输入在第 1 行中给出一个正整数 N,第 2 行给出 N 个待填充的正整数。所有数字不超过 10^​4 ,相邻数字以空格分隔...

2020-03-19 23:52:56 95

空空如也

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

TA关注的人

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