NYOJ
文章平均质量分 81
--Simone-
这个作者很懒,什么都没留下…
展开
-
单调递增最长子序列
原创 2013-08-04 10:01:59 · 28 阅读 · 0 评论 -
拦截导弹(最长下降子序列)
原创 2014-06-16 17:44:33 · 69 阅读 · 0 评论 -
矩形嵌套(DP)
原创 2014-07-04 14:22:40 · 109 阅读 · 0 评论 -
作业题(DP)
原创 2014-07-04 15:29:09 · 41 阅读 · 0 评论 -
Atlantis(线段树 + 扫描线 + 离散化)
the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, these maps describe different regions of Atlantis. Your friend Bill has to know the total area for which maps exist. You (unwisely) volunteered to原创 2014-07-25 23:18:19 · 57 阅读 · 0 评论 -
Monkey and Banana(DP)
f researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with some blocks. If the monkey is clever enough, it shall be able to reach the banana by plac原创 2014-08-06 13:53:56 · 39 阅读 · 0 评论 -
布线问题(最小生成树 + 并查集)
原创 2014-09-03 17:07:24 · 83 阅读 · 0 评论 -
一笔画问题(欧拉回路 + 并查集)
原创 2014-09-03 17:28:34 · 204 阅读 · 0 评论 -
城市平乱(最短路)
原创 2014-09-04 11:54:38 · 42 阅读 · 0 评论 -
修路方案(次小生成树)
原创 2014-09-04 14:38:58 · 73 阅读 · 0 评论 -
校园网络(强连通分量)
如果某系有新软件可用时,该系将允许一些其它的系复制并使用该软件。但该允许关系是单向的,即:A系允许B系使用A的软件时,B未必一定允许A使用B的软件。现在,请你写一个程序,根据各个系之间达成的协议情况,计算出最少需要添加多少个两系之间的这种允许关系,才能使任何一个系有软件使用的时候,其它所有系也都有软件可用。 输入第一行输入一个整数T,表示测试数据的组数(T<10)每组测试数据的第一行是一个整数M,表示共有M个系(2<=M<=100)。随后的M行,原创 2014-09-05 09:56:57 · 47 阅读 · 0 评论 -
星际之门(cayley 定理)
行旅行的,近来,X博士发明了星际之门,它利用虫洞技术,一条虫洞可以连通任意的两个星系,使人们不必再待待便可立刻到达目的地。帝国皇帝认为这种发明很给力,决定用星际之门把自己统治的各个星系连结在一起。可以证明,修建N-1条虫洞就可以把这N个星系连结起来。现在,问题来了,皇帝想知道有多少种修建方案可以把这N个星系用N-1条虫洞连结起来? 输入第一行输入一个整数T,表示测试数据的组数(T<=100)每组测试数据只有一行,该行只有一个整数N,表示有N个星系。(2&原创 2014-09-05 10:35:26 · 92 阅读 · 0 评论 -
网络的可靠性(杂)
助商。它将提供先进的网络协作技术,展示其”智能+互联“的生活概念,同时为参观者提供高品质的个人体验和互动,以”信息通信,尽情城市梦想”为主题贯穿。借助奇幻的剧场大屏幕和特效,展现信息通信技术的应用前景,通过生动形象的故事,向观众展示沟通无限制的未来社会前景。为此,A公司为世博园的N个区域建立了视频通信系统,其中每个区域建立一个基站,编号依次为1,2,3...,N。通过基站之间的通信线路为各区域的参观者提供视频服务。已知在各基站之间已铺设了一些光纤通讯线路,这些线路覆盖了所有的区域,即任意两个区域都可原创 2014-09-05 11:54:08 · 115 阅读 · 0 评论 -
Cow Contest(Floyd 传递闭包)
articipating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating that is unique among the competitors.The contest is conducted in several head-to-head rounds, each between two cows. If原创 2014-09-05 15:54:07 · 53 阅读 · 0 评论 -
Jungle Roads(最小生成树 + 并查集)
blem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so the large road network is too expensive to maintain. The Council of Elders must choose to stop maintaining some roa原创 2014-09-06 09:57:48 · 87 阅读 · 0 评论 -
Battle City(BFS)
nd some people (like me) even often play it on computer now. What we are discussing is a simple edition of this game. Given a map that consists of empty spaces, rivers, steel walls and brick walls only. Your task is to get a bonus as soon as possible supp原创 2014-09-06 10:35:09 · 74 阅读 · 0 评论 -
括号匹配(二)(区间DP)
原创 2014-05-21 17:32:40 · 71 阅读 · 0 评论 -
免费馅饼(DP)
把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不 掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只 能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个身手敏捷的高手,但在现实中运动神经特别迟钝,每秒种只有在移动不超过一米的 范围内接住坠落的馅饼。现在给这条小径如图标上坐标:为了使问题简化,假设在接下来的一段时间里,馅饼都掉落在0-10这11个位置。开始时gameboy站在原创 2014-05-21 09:36:38 · 66 阅读 · 0 评论 -
传纸条(DP)
原创 2014-04-23 09:53:35 · 55 阅读 · 0 评论 -
01串(动态规划)
原创 2013-08-05 17:37:50 · 178 阅读 · 0 评论 -
聪明的kk(动态规划)
原创 2013-08-06 21:33:18 · 66 阅读 · 0 评论 -
最长公共子序列(动态规划)
原创 2013-08-07 10:24:34 · 75 阅读 · 0 评论 -
小猴子下落(二叉树 or 模拟)
右从上到下的编号为1,2,3,·····,2的D次方减1。在结点1处放一个小猴子,它会往下跑。每个内结点上都有一个开关,初始全部关闭,当每次有小猴子跑到一个开关上时,它的状态都会改变,当到达一个内结点时,如果开关关闭,小猴子往左走,否则往右走,直到走到叶子结点。一些小猴子从结点1处开始往下跑,最后一个小猴儿会跑到哪里呢? 输入输入二叉树叶子的深度D,和小猴子数目I,假设I不超过整棵树的叶子个数,D<=20.最终以 0 0 结尾输出输出第I个小猴子所在的叶子编号。样例输原创 2013-08-12 12:15:44 · 93 阅读 · 0 评论 -
士兵杀敌(容斥定理)
原创 2013-08-12 15:01:01 · 56 阅读 · 0 评论 -
A Bug's Life(带权并查集)
vior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite gender. In his experiment, individual bugs and their interactions were easy to identify, because numbers were printed o原创 2013-08-23 19:58:28 · 123 阅读 · 0 评论 -
食物链 (带权并查集)
原创 2013-08-23 21:02:31 · 54 阅读 · 0 评论 -
快速查找素数(素数表)
原创 2013-09-16 00:42:27 · 118 阅读 · 0 评论 -
素数距离问题(素数表)
原创 2013-09-17 17:43:39 · 67 阅读 · 0 评论 -
素数环(DFS)
原创 2013-09-22 13:35:32 · 100 阅读 · 0 评论 -
回文字符串(DP)
原创 2013-09-30 01:27:08 · 100 阅读 · 0 评论 -
苹果...(01背包)
能放入背包的苹果的总价钱最大值。 输入有多组测试数据,每组测试数据第一行为2个正整数,分别代表苹果的个数n和背包的容量v,n、v同时为0时结束测试,此时不输出。接下来的n行,每行2个正整数,用空格隔开,分别代表苹果的大小c和价钱w。所有输入数字的范围大于等于0,小于等于1000。输出对每组测试数据输出一个整数,代表能放入背包的苹果的总价值。样例输入3 31 12 13 10 0样例输出2来源动态规划经典问题 思路:原创 2013-10-08 18:29:13 · 38 阅读 · 0 评论 -
动物统计加强版(字典树)
原创 2014-02-07 16:24:41 · 62 阅读 · 0 评论 -
skiing(DFS)
域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12 11 10 9一个人可以从某个点滑向上下左右相邻四个点之一,当且仅当高度减小。在上面的例子中,一条可滑行的滑坡为24-17-16-1。当然25-24-23-...-3-2-1更长。事实上,这是最长的一条。 输原创 2014-03-02 18:13:10 · 67 阅读 · 0 评论 -
众数问题(Map 按 value 排序)
原创 2014-04-19 17:28:57 · 72 阅读 · 0 评论 -
蛇形填数(模拟)
5 14 37 6 5 4 输入直接输入方陈的维数,即n的值。(n<=100)输出输出结果是蛇形方陈。样例输入3样例输出7 8 16 9 25 4 3 思路: 模拟。 AC:#include <cstdio>#include <algorithm>#include <cstring>u原创 2014-04-20 10:45:45 · 44 阅读 · 0 评论 -
月老的难题(二分图最大匹配)
原创 2014-09-06 11:02:26 · 57 阅读 · 0 评论