- 博客(28)
- 资源 (3)
- 收藏
- 关注
原创 1035 Password (20 分)
1035Password(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 distingu...
2019-04-12 22:41:40 196
原创 1023 Have Fun with Numbers (20 分)
1023Have 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 happe...
2019-04-12 22:13:06 220
原创 1021 Deepest Root
1021Deepest Root(25分)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 ...
2019-04-10 22:39:03 202
原创 1020 Tree Traversals
1020Tree Traversals(25分)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 ...
2019-04-09 20:48:26 232
原创 1019 General Palindromic Number
1019General Palindromic Number(20分)A number that will be the same when it is written forwards or backwards is known as aPalindromic Number. For example, 1234321 is a palindromic number. All sing...
2019-04-09 20:36:25 157
原创 1015 Reversible Primes
1015Reversible Primes(20分)Areversible primein 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 beca...
2019-04-09 18:26:10 254
原创 幸运数
幸运数题目描述幸运数是波兰数学家乌拉姆命名的。它采用与生成素数类似的“筛法”生成。首先从1开始写出自然数123456....1 就是第一个幸运数。我们从2这个数开始。把所有序号能被2整除的项删除,变为:1 _ 3 _ 5 _ 7 _ 9 ....把它们缩紧,重新记序,为:1 3 5 7 9 .... 。这时,3为第2个幸运数,然后把所有能被3整除的序号位置的数删去。注意,是序...
2019-04-09 13:53:01 385
原创 1013 Battle Over Cities
1013Battle Over Cities(25分)It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We...
2019-04-08 15:29:52 241
原创 1011 World Cup Betting
1011World 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...
2019-04-08 13:49:28 199
原创 1010 Radix
1010Radix(25分)Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer isyes, if 6 is a decimal number and 110 is a binary number.Now for any pa...
2019-04-07 20:32:55 134
原创 1009 Product of Polynomials
1009Product of Polynomials(25分)This time, you are supposed to findA×BwhereAandBare two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines...
2019-04-07 18:49:38 130
原创 1003 Emergency
1003Emergency(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...
2019-04-07 17:36:51 141
原创 An Easy Task
Problem Description Ignatius was born in a leap year, so he want to know when he could hold his birthday party. Can you tell him? Given a positive integers Y which indicate the start year, ...
2019-04-05 19:15:07 228
原创 1007 Maximum Subsequence Sum
1007Maximum Subsequence Sum(25分)Given a sequence ofKintegers {N1,N2, ...,NK}. A continuous subsequence is defined to be {Ni,Ni+1, ...,Nj} where1≤i≤j≤K. The Maximum Su...
2019-04-03 22:18:51 131
原创 1006 Sign In and Sign Out
1006Sign 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 reco...
2019-04-03 21:47:47 180
原创 1004 Counting Leaves
1004Counting Leaves(30分)A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input Specification:Each input file contains on...
2019-04-03 21:21:09 122
原创 7-11 玩转二叉树
L2-3玩转二叉树(25分)给定一棵二叉树的中序遍历和前序遍历,请你先将树做个镜面反转,再输出反转后的层序遍历的序列。所谓镜面反转,是指将所有非叶结点的左右孩子对换。这里假设键值都是互不相等的正整数。输入格式:输入第一行给出一个正整数N(≤30),是二叉树中结点的个数。第二行给出其中序遍历序列。第三行给出其前序遍历序列。数字间以空格分隔。输出格式:在一行中输出该树反转后的...
2019-03-29 19:26:27 526
原创 7-12 关于堆的判断
7-12关于堆的判断(25分)将一系列给定数字顺序插入一个初始为空的小顶堆H[]。随后判断一系列相关命题是否为真。命题分下列几种:x is the root:x是根结点; x and y are siblings:x和y是兄弟结点; x is the parent of y:x是y的父结点; x is a child of y:x是y的一个子结点。输入格式:每组测试第1行...
2019-03-22 20:17:44 1101
原创 7-10 排座位
7-10排座位(25分)布置宴席最微妙的事情,就是给前来参宴的各位宾客安排座位。无论如何,总不能把两个死对头排到同一张宴会桌旁!这个艰巨任务现在就交给你,对任何一对客人,请编写程序告诉主人他们是否能被安排同席。输入格式:输入第一行给出3个正整数:N(≤100),即前来参宴的宾客总人数,则这些人从1到N编号;M为已知两两宾客之间的关系数;K为查询的条数。随后M行,每行给出一对宾客之...
2019-03-22 18:18:15 244
原创 7-4 帅到没朋友
7-4帅到没朋友(20分)当芸芸众生忙着在朋友圈中发照片的时候,总有一些人因为太帅而没有朋友。本题就要求你找出那些帅到没有朋友的人。输入格式:输入第一行给出一个正整数N(≤100),是已知朋友圈的个数;随后N行,每行首先给出一个正整数K(≤1000),为朋友圈中的人数,然后列出一个朋友圈内的所有人——为方便起见,每人对应一个ID号,为5位数字(从00000到99999),ID间以...
2019-03-21 17:47:20 172
原创 7-7 输出GPLT
7-7输出GPLT(20分)给定一个长度不超过10000的、仅由英文字母构成的字符串。请将字符重新调整顺序,按GPLTGPLT....这样的顺序输出,并忽略其它字符。当然,四种字符(不区分大小写)的个数不一定是一样多的,若某种字符已经输出完,则余下的字符仍按GPLT的顺序打印,直到所有字符都被输出。输入格式:输入在一行中给出一个长度不超过10000的、仅由英文字母构成的非空字符串...
2019-03-21 17:45:10 236
原创 7-12 愿天下有情人都是失散多年的兄妹
7-12愿天下有情人都是失散多年的兄妹(25分)呵呵。大家都知道五服以内不得通婚,即两个人最近的共同祖先如果在五代以内(即本人、父母、祖父母、曾祖父母、高祖父母)则不可通婚。本题就请你帮助一对有情人判断一下,他们究竟是否可以成婚?输入格式:输入第一行给出一个正整数N(2≤N≤104),随后N行,每行按以下格式给出一个人的信息:本人ID 性别 父亲ID 母亲ID...
2019-03-19 21:10:51 213
原创 7-13 是否完全二叉搜索树
7-13是否完全二叉搜索树(30分)将一系列给定数字顺序插入一个初始为空的二叉搜索树(定义为左子树键值大,右子树键值小),你需要判断最后的树是否一棵完全二叉树,并且给出其层序遍历的结果。输入格式:输入第一行给出一个不超过20的正整数N;第二行给出N个互不相同的正整数,其间以空格分隔。输出格式:将输入的N个正整数顺序插入一个初始为空的二叉搜索树。在第一行中输出结果树的层序遍...
2019-03-19 18:03:09 236
原创 列车调度
7-11列车调度(25 分)火车站的列车调度铁轨的结构如下图所示。两端分别是一条入口(Entrance)轨道和一条出口(Exit)轨道,它们之间有N条平行的轨道。每趟列车从入口可以选择任意一条轨道进入,最后从出口离开。在图中有9趟列车,在入口处按照{8,4,2,5,3,9,1,6,7}的顺序排队等待进入。如果要求它们必须按序号递减的顺序从出口离开,则至少需要多少条平行铁轨用于调度?...
2019-03-12 10:21:58 348 1
原创 重排链表
L2-2重排链表(25 分)给定一个单链表L1→L2→⋯→Ln−1→Ln,请编写程序将链表重新排列为Ln→L1→Ln−1→L2→⋯。例如:给定L为1→2→3→4→5→6,则输出应该为6→1→5→2→4→3。输入格式:每个输入包含1个测试用例。每个测试用例第1行给出第1个结点的地址和结点总个数,即正整数N(≤105)。结点的...
2019-03-11 11:38:41 351
原创 点赞狂魔
L2-1点赞狂魔(25 分)微博上有个“点赞”功能,你可以为你喜欢的博文点个赞表示支持。每篇博文都有一些刻画其特性的标签,而你点赞的博文的类型,也间接刻画了你的特性。然而有这么一种人,他们会通过给自己看到的一切内容点赞来狂刷存在感,这种人就被称为“点赞狂魔”。他们点赞的标签非常分散,无法体现出明显的特性。本题就要求你写个程序,通过统计每个人点赞的不同标签的数量,找出前3名点赞狂魔。输入...
2019-03-11 10:37:37 642
原创 天梯赛座位分配
L1-1天梯赛座位分配(20 分)天梯赛每年有大量参赛队员,要保证同一所学校的所有队员都不能相邻,分配座位就成为一件比较麻烦的事情。为此我们制定如下策略:假设某赛场有 N 所学校参赛,第 i 所学校有 M[i] 支队伍,每队 10 位参赛选手。令每校选手排成一列纵队,第 i+1 队的选手排在第 i 队选手之后。从第 1 所学校开始,各校的第 1 位队员顺次入座,然后是各校的第 2 位队员…...
2019-03-09 12:51:15 242
原创 7-3 QQ帐户的申请与登陆
问题描述:实现QQ新帐户申请和老帐户登陆的简化版功能。最大挑战是:据说现在的QQ号码已经有10位数了。输入格式:输入首先给出一个正整数N(≤105),随后给出N行指令。每行指令的格式为:“命令符(空格)QQ号码(空格)密码”。其中命令符为“N”(代表New)时表示要新申请一个QQ号,后面是新帐户的号码和密码;命令符为“L”(代表Login)时表示是老帐户登陆,后面是登陆信息。QQ号码为一个不...
2018-05-03 15:15:32 831
yolov3-tiny.zip
2020-03-12
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人