ACM训练
文章平均质量分 86
ACM程序设计大赛是大学级别最高的脑力竞赛,素来被冠以"程序设计的奥林匹克"的尊称。是世界范围内历史最悠久、规模最大的程序设计竞赛。本专栏选择历届大赛的题目训练大家的逻辑思维和编码能力。
zkzqzzz
德玛西亚!
展开
-
Good Article Good sentence
题目描述In middle school, teachers used to encourage us to pick up pretty sentences so that we could apply those sentences in our own articles. One of my classmates ZengXiao Xian, wanted to get senten原创 2017-12-18 11:19:16 · 11066 阅读 · 0 评论 -
str2int
题目描述In this problem, you are given several strings that contain only digits from '0' to '9', inclusive. An example is shown below. 101 123 The set S of strings is consists of the N strings原创 2017-12-18 11:20:31 · 14039 阅读 · 0 评论 -
女友的考验
题目描述 终于放寒假了,小明要和女朋友一起去看电影。这天,女朋友想给小明一个考验,在小明正准备出发的时候,女朋友告诉他,她在电影院等他,小明过来的路线必须满足给定的规则: 1、假设小明在的位置是1号点,女朋友在的位置是n号点,则他们之间有n-2个点可以走,小明每次走的时候只能走到比当前所在点编号大的位置; 2、小明来的时候不能按一定的顺序经过某些地方。比如,如果女朋友告诉原创 2017-12-18 11:22:16 · 10952 阅读 · 0 评论 -
Reincarnation
题目描述Now you are back,and have a task to do: Given you a string s consist of lower-case English letters only,denote f(s) as the number of distinct sub-string of s. And you have some query,each原创 2017-12-18 11:25:07 · 10869 阅读 · 0 评论 -
Victor and String
题目描述Victor loves to play with string. He thinks a string is charming as the string is a palindromic string. Victor wants to play $n$ times. Each time he will do one of following four operation原创 2017-12-18 11:26:25 · 12015 阅读 · 0 评论 -
GRE Words
题目描述Recently George is preparing for the Graduate Record Examinations (GRE for short). Obviously the most important thing is reciting the words. Now George is working on a word list containing N原创 2017-12-15 10:14:01 · 11765 阅读 · 0 评论 -
Dynamic Lover
题目描述As a famous person with universal love, changing girlfriend too often makes me harassment because I can't keep their name in mind timely. To remember who is my lover now, I buy a magic passwor原创 2017-12-15 10:18:23 · 13957 阅读 · 0 评论 -
考研路茫茫――单词情结
背单词,始终是复习英语的重要环节。在荒废了3年大学生涯后,Lele也终于要开始背单词了。 一天,Lele在某本单词书上看到了一个根据词根来背单词的方法。比如"ab",放在单词前一般表示"相反,变坏,离去"等。 于是Lele想,如果背了N个词根,那这些词根到底会不会在单词里出现呢。更确切的描述是:长度不超过L,只由小写字母组成的,至少包含一个词根的单词,一共可能有多少个呢?这里就不考虑单原创 2017-12-15 09:44:49 · 10934 阅读 · 0 评论 -
Wireless Password
题目描述Liyuan lives in a old apartment. One day, he suddenly found that there was a wireless network in the building. Liyuan did not know the password of the network, but he got some important inform原创 2017-12-15 09:47:58 · 11693 阅读 · 0 评论 -
病毒侵袭持续中
题目描述小t非常感谢大家帮忙解决了他的上一个问题。然而病毒侵袭持续中。在小t的不懈努力下,他发现了网路中的“万恶之源”。这是一个庞大的病毒网站,他有着好多好多的病毒,但是这个网站包含的病毒很奇怪,这些病毒的特征码很短,而且只包含“英文大写字符”。当然小t好想好想为民除害,但是小t从来不打没有准备的战争。知己知彼,百战不殆,小t首先要做的是知道这个病毒网站特征:包含多少不同的病毒,每种病毒出原创 2017-12-15 09:49:39 · 12434 阅读 · 0 评论 -
最长回文
题目描述给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度. 回文就是正反读都是一样的字符串,如aba, abba等输入描述:输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S 两组case之间由空行隔开(该空行不用处理) 字符串长度len 输出描述:每一行一个整数x,对原创 2017-12-15 09:52:19 · 11443 阅读 · 0 评论 -
Count the string
题目描述It is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write down all the non-empty prefixes of this string. For example:原创 2017-12-15 09:56:48 · 10872 阅读 · 0 评论 -
Boring counting
题目描述035 now faced a tough problem,his english teacher gives him a string,which consists with n lower case letter,he must figure out how many substrings appear at least twice,moreover,such apearanc原创 2017-12-15 09:59:35 · 12756 阅读 · 0 评论 -
Best Reward
题目描述After an uphill battle, General Li won a great victory. Now the head of state decide to reward him with honor and treasures for his great exploit. One of these treasures is a necklace made原创 2017-12-15 10:04:37 · 12627 阅读 · 0 评论 -
Cyclic Nacklace
题目描述CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking abou原创 2017-12-15 10:06:33 · 10993 阅读 · 0 评论 -
Number Sequence
Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1],b[2], ...... , b[M] (1 Your task is to find a number K which make a[K] = b[1], a[K + 1] = b[2],...... , a[K + M - 1] = b[M]. If the原创 2017-12-06 08:49:11 · 11611 阅读 · 0 评论 -
魔咒字典
哈利波特在魔法学校的必修课之一就是学习魔咒。据说魔法世界有100000种不同的魔咒,哈利很难全部记住,但是为了对抗强敌,他必须在危急时刻能够调用任何一个需要的魔咒,所以他需要你的帮助。 给你一部魔咒词典。当哈利听到一个魔咒时,你的程序必须告诉他那个魔咒的功能;当哈利需要某个功能但不知道该用什么魔咒时,你的程序要替他找到相应的魔咒。如果他要的魔咒不在词典中,就输出“what?” 输入原创 2017-12-06 09:08:56 · 12351 阅读 · 0 评论 -
Keywords Search
In the modern time, Search engine came into the life of everybody likeGoogle, Baidu, etc.Wiskey also wants to bring this feature to his image retrieval system. Every image have a long descriptio原创 2017-12-06 09:14:28 · 12896 阅读 · 0 评论 -
Max Num
Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14. The fi原创 2017-11-30 08:56:29 · 13714 阅读 · 0 评论 -
Common Sequence
A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exists a strictly incr原创 2017-11-30 08:59:51 · 12724 阅读 · 0 评论 -
最大连续子序列
给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 例如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序列为{ 11, -4, 13 },最大和 为20。 在今年的数据结构考卷中,要求编写程序得到最大和,现在增加一个要求,即还需要输出该 子序列的第一个和最后一个元素。原创 2017-11-30 09:02:31 · 12051 阅读 · 0 评论 -
统计难题
题目描述Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). 输入描述:输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都原创 2017-11-30 09:05:31 · 12282 阅读 · 0 评论 -
全文检索
题目描述我们大家经常用google检索信息,但是检索信息的程序是很困难编写的;现在请你编写一个简单的全文检索程序。 问题的描述是这样的:给定一个信息流文件,信息完全有数字组成,数字个数不超过60000个,但也不少于60个;再给定一个关键字集合,其中关键字个数不超过10000个,每个关键字的信息数字不超过60个,但也不少于5个;两个不同的关键字的前4个数字是不相同的;由于流文件太长,已经原创 2017-11-30 09:10:29 · 29131 阅读 · 0 评论 -
Period
题目描述For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for ea原创 2017-11-30 09:12:10 · 30603 阅读 · 0 评论 -
Longest Common Substring
题目描述Given two strings, you have to tell the length of the Longest Common Substring of them. For example: str1 = banana str2 = cianaic So the Longest Common Substring is "ana", and the原创 2017-11-30 09:13:48 · 28614 阅读 · 0 评论 -
Equations
题目描述Consider equations having the following form: a*x1^2+b*x2^2+c*x3^2+d*x4^2=0 a, b, c, d are integers from the interval [-50,50] and any of them cannot be 0. It is consider a solution原创 2017-11-30 09:15:08 · 16111 阅读 · 0 评论 -
Nested Dolls
题目描述Dilworth is the world’s most prominent collector of Russian nested dolls: he literally has thousands of them! You know, the wooden hollow dolls of different sizes of which the smallest doll is原创 2017-11-30 09:16:43 · 24445 阅读 · 1 评论 -
Oulipo
题目描述The French author Georges Perec (1936�1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, m原创 2017-11-30 09:18:56 · 17172 阅读 · 0 评论