03 2019 档案

摘要:链接:https://ac.nowcoder.com/acm/contest/551/B来源:牛客网 题目描述 CSL 为了备战即将到来的六级考试,在外面报了一个英语培训班。经过了一学期的学习后,英语老师决定要对 CSL 的学习成果进行检测。老师准备了一份卷子,考虑到 CSL 的英语水平,卷子上只有 阅读全文
posted @ 2019-03-31 19:23 明霞 阅读(424) 评论(0) 推荐(0)
摘要:Description Description 平面上有n个矩形,给定每个矩形的左下角坐标和右上角坐标。如果把重合的矩形合并成一个图形,则经过合并之后,还剩多少个图形? 平面上有n个矩形,给定每个矩形的左下角坐标和右上角坐标。如果把重合的矩形合并成一个图形,则经过合并之后,还剩多少个图形? Inpu 阅读全文
posted @ 2019-03-28 19:47 明霞 阅读(286) 评论(0) 推荐(0)
摘要:Description Description Huffman树在编码中有着广泛的应用。在这里,我们只关心Huffman树的构造过程。 给出一列数{pi}={p0, p1, …, pn-1},用这列数构造Huffman树的过程如下: 1. 找到{pi}中最小的两个数,设为pa和pb,将pa和pb从{ 阅读全文
posted @ 2019-03-24 20:11 明霞 阅读(152) 评论(0) 推荐(0)
摘要:在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗? Input输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000 阅读全文
posted @ 2019-03-19 20:17 明霞 阅读(171) 评论(0) 推荐(0)
摘要:某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。 现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。 Input本题目包含多组数据,请 阅读全文
posted @ 2019-03-19 19:41 明霞 阅读(191) 评论(0) 推荐(0)
摘要:给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。 Input输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是两个数 s, 阅读全文
posted @ 2019-03-19 19:02 明霞 阅读(192) 评论(0) 推荐(0)
摘要:Description Description Fibonacci numbers are well-known as follow: Now given an integer N, please find out whether N can be represented as the sum of 阅读全文
posted @ 2019-03-17 21:33 明霞 阅读(177) 评论(0) 推荐(0)
摘要:The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. H 阅读全文
posted @ 2019-03-15 21:24 明霞 阅读(315) 评论(0) 推荐(0)
摘要:Description Description 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种 阅读全文
posted @ 2019-03-14 21:20 明霞 阅读(252) 评论(0) 推荐(0)
摘要:There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say t 阅读全文
posted @ 2019-03-12 21:49 明霞 阅读(284) 评论(0) 推荐(0)
摘要:The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ag 阅读全文
posted @ 2019-03-12 20:30 明霞 阅读(165) 评论(0) 推荐(0)
摘要:You are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, and a set of possible 阅读全文
posted @ 2019-03-11 21:29 明霞 阅读(435) 评论(0) 推荐(0)
摘要:今天学习了有点骚气的树状数组(其实学了几天了,今天才理解) Problem Description N个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lel 阅读全文
posted @ 2019-03-10 22:10 明霞 阅读(146) 评论(0) 推荐(0)
摘要:在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。 你的任务是,对于给定的N,求出有多少种合法的放置方法。 Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output共有若 阅读全文
posted @ 2019-03-05 21:24 明霞 阅读(277) 评论(0) 推荐(0)
摘要:思路:这道题无法用平时0(n^2)的解法来求最长上升子序列,会超时,只能用优化的最长上升子序列算法来求 You are given a problemset consisting of nn problems. The difficulty of the ii -th problem is aiai 阅读全文
posted @ 2019-03-05 18:39 明霞 阅读(375) 评论(0) 推荐(0)
摘要:思路:这道题要重复数字的下标存起来,把没出现过的数字标记起来并且存起来,然后再把重复的数字换成没出现过的(没出现过的数字的数量 = 重复数字的数量) Companies always have a lot of equipment, furniture and other things. All o 阅读全文
posted @ 2019-03-04 20:29 明霞 阅读(189) 评论(0) 推荐(0)
摘要:Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a wel 阅读全文
posted @ 2019-03-03 21:47 明霞 阅读(155) 评论(0) 推荐(0)
摘要:You are given a string tt consisting of nn lowercase Latin letters and an integer number kk . Let's define a substring of some string ss with indices 阅读全文
posted @ 2019-03-03 20:34 明霞 阅读(293) 评论(0) 推荐(0)