随笔分类 -  NYoj

摘要:Substring时间限制:1000ms | 内存限制:65535KB难度:1描述You are given a string input. You are to find the longest substring of input such that the reversal of the substring is also a substring of input. In case of a tie, return the string that occurs earliest in input.Note well: The substring and its reversal may 阅读全文
posted @ 2014-04-12 10:19 CastleDrv 阅读(184) 评论(0) 推荐(0)
摘要:蚂蚁的难题(二) 时间限制:1000ms | 内存限制:65535KB 难度:3描述下雨了,下雨了,蚂蚁搬家了。已知有n种食材需要搬走,这些食材从1到n依次排成了一个圈。小蚂蚁对每种食材都有一个喜爱程度值Vi,当然,如果Vi小于0的时候,表示蚂蚁讨厌这种食材。因为马上就要下雨了,所以蚂蚁只能搬一次,但是能够搬走连续一段的食材。时间紧急,你快帮帮小蚂蚁吧,让它搬走的食材喜爱值和最大。输入有多组测试数据(以EOF结尾)。每... 阅读全文
posted @ 2014-04-09 08:29 CastleDrv 阅读(300) 评论(0) 推荐(0)
摘要:众数问题 时间限制:3000 ms | 内存限制:65535 KB 难度:3描述所谓众数,就是对于给定的含有N个元素的多重集合,每个元素在S中出现次数最多的成为该元素的重数,多重集合S重的重数最大的元素成为众数。例如:S={1,2,2,2,3,5},则多重集S的众数是2,其重数为3。现在你的任务是... 阅读全文
posted @ 2014-04-06 16:07 CastleDrv 阅读(271) 评论(0) 推荐(0)
摘要:找球号(一) 时间限制:3000 ms | 内存限制:65535 KB 难度:3描述在某一国度里流行着一种游戏。游戏规则为:在一堆球中,每个球上都有一个整数编号i(0# includeint a[1000001];int cmp(const void * p1,const void * p2){ return *(int *)p1-*(int *)p2;}int search(int i,int j,int n){ int mid; while(in) j = mid; else i = mid+1; } return 0;}int main(vo... 阅读全文
posted @ 2014-04-06 15:59 CastleDrv 阅读(308) 评论(0) 推荐(0)