08 2018 档案
摘要:给定有向图G=(V,E)。设P 是G 的一个简单路(顶点不相交)的集合。如果V 中每个顶点恰好在P 的一条路上,则称P是G 的一个路径覆盖。P 中路径可以从V 的任何一个顶点开始,长度也是任意的,特别地,可以为0。G 的最小路径覆盖是G 的所含路径条数最少的路径覆盖。设计一个有效算法求一个有向无环图
阅读全文
摘要:度度熊参与了喵哈哈村的商业大会,但是这次商业大会遇到了一个难题: 喵哈哈村以及周围的村庄可以看做是一共由n个片区,m条公路组成的地区。 由于生产能力的区别,第i个片区能够花费a[i]元生产1个商品,但是最多生产b[i]个。 同样的,由于每个片区的购买能力的区别,第i个片区也能够以c[i]的价格出售最
阅读全文
摘要:Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K asteroids
阅读全文
摘要:Cows are such finicky eaters. Each cow has a preference for certain foods and drinks, and she will consume no others. Farmer John has cooked fabulous
阅读全文
摘要:Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhi
阅读全文
摘要:As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduling problems d
阅读全文
摘要:小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽量多的一些国际象棋里面的“车”,并且使得他们不能互相攻击,这当然很简单,但是Gardon限制了只有某些格子才可以放,小希还是很轻松的解决了这个问题(见下图)注意不能放车的地方不影响车的互相攻击。 所以现在Gardon想让小希来解决一个更
阅读全文
摘要:传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。 这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一间房子。 另一方面,村长和另外的村领
阅读全文
摘要:There are a group of students. Some of them may know each other, while others don't. For example, A and B know each other, B and C know each other. Bu
阅读全文
摘要:N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each
阅读全文
摘要:A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different h
阅读全文
摘要:Cerror is the mayor of city HangZhou. As you may know, the traffic system of this city is so terrible, that there are traffic jams everywhere. Now, Ce
阅读全文
摘要:There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two
阅读全文
摘要:You are a lover of bacteria. You want to raise some bacteria in a box. Initially, the box is empty. Each morning, you can put any number of bacteria i
阅读全文
摘要:Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pair li and ri and asks you to count the
阅读全文
摘要:维护一个序列,要求支持下列2种操作: add a b c:区间[a,b]中每个数加上c count a b:查询区间[a,b]中有多少数是k的倍数(k为给定常数) 维护一个序列,要求支持下列2种操作: add a b c:区间[a,b]中每个数加上c count a b:查询区间[a,b]中有多少数
阅读全文
摘要:给你N个数,有两种操作 1:给区间[a,b]内的所有数都增加X 2:询问区间[a,b]能被7整除的个数 输入描述 Input Description 第一行一个正整数n,接下来n行n个整数,再接下来一个正整数Q,表示操作的个数. 接下来Q行每行若干个整数。如果第一个数是add,后接3个正整数a,b,
阅读全文
摘要:有n个数和5种操作 add a b c:把区间[a,b]内的所有数都增加c set a b c:把区间[a,b]内的所有数都设为c sum a b:查询区间[a,b]的区间和 max a b:查询区间[a,b]的最大值 min a b:查询区间[a,b]的最小值 有n个数和5种操作 add a b
阅读全文
摘要:Now you get a number N, and a M-integers set, you should find out how many integers which are small than N, that they can divided exactly by any integ
阅读全文
摘要:Every year there is the same problem at Halloween: Each neighbour is only willing to give a certain total number of sweets on that day, no matter how
阅读全文
摘要:小L正在组织acm暑假集训,但众所周知,暑假集训的萌新中有OI神犇,也有暑假才开始学算法的萌新,如果统一集训的难度,无法很好地让萌新们得到训练,所以小L想了一个办法,根据每次测试的情况,改变萌新们的集训难度。现在将萌新们编号为1到n,最初萌新们的集训难度为v0,测试后有两种操作,第一种是某一区间的萌
阅读全文
摘要:Description Wells最近经常做一些有皮神出现的梦。 在这一次梦中Wells把皮神(Pikachu)弄丢了,Wells在一个正 N 边形区域的中心开始自闭,Wells想找回皮神,同时皮神也在尝试找回Wells。 皮神为了确保不会找不到Wells,皮神在正 NN 边形最外围的每个顶点上都放
阅读全文
摘要:小t非常感谢大家帮忙解决了他的上一个问题。然而病毒侵袭持续中。在小t的不懈努力下,他发现了网路中的“万恶之源”。这是一个庞大的病毒网站,他有着好多好多的病毒,但是这个网站包含的病毒很奇怪,这些病毒的特征码很短,而且只包含“英文大写字符”。当然小t好想好想为民除害,但是小t从来不打没有准备的战争。知己
阅读全文
摘要:You are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell of the cave can contain any amount of gold. Initially you are i
阅读全文
摘要:You are in a maze; seeing n doors in front of you in beginning. You can choose any door you like. The probability for choosing a door is equal for all
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6356 Glad You Game Steve has an integer array aa of length nn (1-based). He assigned all the elements a
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6315 In a galaxy far, far away, there are two integer sequence a and b of length n. b is a static permu
阅读全文
摘要:You are given an array aa consisting of nn integers, and qq queries to it. ii-th query is denoted by two integers lili and riri. For each query, you h
阅读全文
摘要:For the k-th number, we all should be very familiar with it. Of course,to kiki it is also simple. Now Kiki meets a very similar problem, kiki wants to
阅读全文
摘要:杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。 不吉利的数字为所有含有4或62的号码。例如: 62315 73418 8891
阅读全文
摘要:Jimmy writes down the decimal representations of all natural numbers between and including m and n, (m ≤ n). How many zeroes will he write down? Input
阅读全文
摘要:题目链接: https://odzkskevi.qnssl.com/0c87453efec2747f8e8a573525fd42f9?v=1533651456 题解: 这是一道Trie+BFS的题目; 这是第二次写了 Orz 还是WA好几发; 这一题,我们可以用字典树存已有的单词,在存的时候,记录一
阅读全文
摘要:Kelukin is a businessman. Every day, he travels around cities to do some business. On August 17th, in memory of a great man, citizens will read a book
阅读全文
摘要:ACboy很喜欢玩一种战略游戏,在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物。但由于地理位置原因,有些城堡不能直接攻克,要攻克这些城堡必须先攻克其他某一个特定的城堡。你能帮ACboy算出要获得尽量多的宝物应该攻克哪M个城堡吗? Input每
阅读全文
摘要:Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game
阅读全文
摘要:The multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the r
阅读全文
摘要:现在有n堆石子,第i堆有ai个石子。现在要把这些石子合并成一堆,每次只能合并相邻两个,每次合并的代价是两堆石子的总石子数。求合并所有石子的最小代价。 Input 第一行包含一个整数T(T<=50),表示数据组数。每组数据第一行包含一个整数n(2<=n<=100),表示石子的堆数。第二行包含n个正整数
阅读全文
摘要:New labyrinth attraction is open in New Lostland amusement park. The labyrinth consists of n rooms connected by m passages. Each passage is colored in
阅读全文
摘要:Ignatius再次被魔王抓走了(搞不懂他咋这么讨魔王喜欢)…… 这次魔王汲取了上次的教训,把Ignatius关在一个n*m的地牢里,并在地牢的某些地方安装了带锁的门,钥匙藏在地牢另外的某些地方。刚开始Ignatius被关在(sx,sy)的位置,离开地牢的门在(ex,ey)的位置。Ignatius每
阅读全文
摘要:The Czech Technical University is rather old — you already know that it celebrates 300 years of its existence in 2007. Some of the university building
阅读全文
摘要:A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, ..., xm > another
阅读全文
摘要:This is yet another problem dealing with regular bracket sequences. We should remind you that a bracket sequence is called regular, if by inserting «+
阅读全文
摘要:There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees
阅读全文
摘要:'Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the routing designers have screwed up completely, ma
阅读全文
摘要:Farmer John's family pitches in with the chores during milking, doing all the chores as quickly as possible. At FJ's house, some chores cannot be star
阅读全文
摘要:一:N条直线分割平面 假设,x条线能将平面分为f(x)份,这对于份f(n) 第n条线,和其他n-1条线都有交点时,增加量最大,为n; 则: f(n)=f(n-1)+n; 有f(0)=1;得到:n 条直线分割平面的数量最大为:f(n)=n*(n+1)/2 + 1; 二. “V” 形线分割平面 对于“V
阅读全文
摘要:Disky and Sooma, two of the biggest mega minds of Bangladesh went to a far country. They ate, coded and wandered around, even in their holidays. They
阅读全文