- 博客(997)
- 资源 (15)
- 收藏
- 关注
原创 POJ3450:Corporate Identity(后缀数组)
DescriptionBeside other services, ACM helps companies to clearly state their “corporate identity”, which includes company logo but also other signs, like trademarks. One of such companies is Inter
2015-06-09 19:50:53 2744
原创 Codeforces550E:Brackets in Implications
Implication is a function of two logical arguments, its value is false if and only if the value of the first argument is true and the value of the second argument is false.Implication is written b
2015-06-09 16:31:45 1327
原创 Codeforces550D:Regular Bridge
An undirected graph is called k-regular, if the degrees of all its vertices are equal k. An edge of a connected graph is called a bridge, if after removing it the graph is being split into two con
2015-06-09 16:17:19 1459
原创 Codeforces550C:Divisibility by Eight
You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.Your task is to determine if it is possible in this case to r
2015-06-09 15:50:32 2036
原创 Codeforces550B:Preparing Olympiad
You have n problems. You have estimated the difficulty of the i-th one as integer ci. Now you want to prepare a problemset for a contest, using some of the problems you've made.A problemset fo
2015-06-09 15:45:06 1475
原创 Codeforces550A:Two Substrings
You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).InputThe only line of
2015-06-09 15:42:08 1608
原创 POJ3623:Best Cow Line, Gold(后缀数组)
DescriptionFJ is about to take his N (1 ≤ N ≤ 30,000) cows to the annual"Farmer of the Year" competition. In this contest every farmer arranges his cows in a line and herds them past the judges.
2015-06-08 22:19:13 1680
原创 POJ3581:Sequence(后缀数组)
DescriptionGiven a sequence, {A1, A2, ..., An} which is guaranteed A1 > A2, ..., An, you are to cut it into three sub-sequences and reverse them separately to form a new one which is the smalle
2015-06-08 20:39:01 2561
原创 POJ1226:Substrings(后缀数组)
DescriptionYou are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found as a substring of any of the given
2015-06-08 14:26:16 2315
原创 SPOJ220:Relevant Phrases of Annihilation(后缀数组)
DescriptionYou are the King of Byteland. Your agents have just intercepted a batch of encrypted enemy messages concerning the date of the planned attack on your island. You immedietaly send for
2015-06-08 11:43:18 1429
原创 POJ3294:Life Forms(后缀数组)
DescriptionYou may have wondered why most extraterrestrial life forms resemble humans, differing by superficial traits such as height, colour, wrinkles, ears, eyebrows and the like. A few bear no
2015-06-08 10:48:24 5071 1
原创 POJ3415:Common Substrings(后缀数组+单调栈)
DescriptionA substring of a string T is defined as:T(i, k)=TiTi+1...Ti+k-1, 1≤i≤i+k-1≤|T|.Given two strings A, B and one integer K, we define S, a set of triples (i, j, k):S = {(i, j,
2015-06-07 22:06:03 1824 1
原创 hunnu11550:欧拉函数
Problem description 一个数x的欧拉函数Φ(x)定义为所有小于x的正整数中与x互质的数的数目,如小于5且和5互质的数有1、2、3、4,一共4个,故Φ(5)=4。对于任意正整数x,我们定义两种操作: 1、f(x) = x + Φ(x);2、g(x) = x * Φ(x);现在,给定一个数a,问从1开始,需要多少步操作能得到a。(如,当a =
2015-06-07 20:23:23 1226
原创 hunnu11546:Sum of f(x)
Problem description 令f(x)为x的所有约数之和,x的约数即可以被x整除的数,如f(24)=1+2+3+4+6+8+12+24=60),求 f(l) + f(l + 1) + …… + f(r)Input 第一行为一个整数T(T接下来T行,每行有两个整数l,r(1 Output 对每组数据,输出f(l
2015-06-07 20:19:46 849
原创 hunnu11544:小明的烦恼——找字符串
Problem description 小明是个很优秀的同学,他除了特别公正外,他也很细心,当然老师肯定也知道,这不,老师又有事情找他帮忙了,老师每周都会给他一个字符串A,然后问小明“A字符串的循环移位产生的所有字符串中,字典序最小的是哪个”,于是小明屁颠屁颠的一个一个比对,但是长久下来,小明实在是受不了了,所以他想请你帮帮他。同样,你帮他解决,你就会多AC一个题目。 Hint:
2015-06-07 20:08:16 1558 2
原创 hunnu11543:小明的烦恼——分糖果
Problem description 小明在班里一直是个很公正的孩子,这点同学和老师都很清楚,这不,老师每周都会从家里带来一些糖果,然后叫小明把糖果分给其他小朋友,但这个班里的同学都有一个很特别的性格,就是他们只喜欢偶数,对于糖果也一样,所以小明在分糖果时也必须要保证这一点,即使每个同学分的糖果数量不一样。都是奇怪的是,小明有时候并不能够合格的分糖果,这让他大为苦恼,害怕别的同学会
2015-06-07 20:06:22 2380
原创 POJ3693:Maximum repetition substring(后缀数组+RMQ)
DescriptionThe repetition number of a string is defined as the maximum number R such that the string can be partitioned into R same consecutive substrings. For example, the repetition number of "a
2015-06-01 21:52:28 2740
原创 POJ2406:Power Strings(后缀数组DC3)
DescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponenti
2015-06-01 14:36:25 3063
原创 CSU1646: HearthStone(DP)
DescriptionHenry十分钟爱炉石传说(Heart Stone)这款有趣的桌面卡牌游戏。我们简化的游戏规则如下:游戏由两人对战,出牌并尽量对对方造成最大的伤害,一共进行 r轮。前10轮,第i轮你有i个法力水晶;之后每轮都有10个法力水晶。前一轮未使用的法力水晶不能累积到下一轮。有两种卡牌,随从卡 “达拉然法师” 和 法术卡 “刺骨”。
2015-05-31 18:35:19 1246
原创 CSU1648: Swipe
Description德鲁伊在炉石传说中是一个很稳定的职业,主流的卡组套路有咆哮德,城墙德以及让人很无奈的疲劳德。然而,大部分的卡组总都包括“横扫”这张德鲁伊的职业法术卡。 我们假定战场上的敌人数目不定,敌人的血量已知,我们想知道最少使用多少张“横扫”能消灭战场上所有敌人。Input第一行一个整数T( T接下来有T组数据,每组数据第一行n (
2015-05-31 18:31:43 928
原创 CSU1649: Transfer
Description给你一个用火柴棍摆成的个位数加减法算式,要你求出至少要移动多少根火柴棍才能使算式成立。等于和加号的那一横和减号不能移动,加号移掉一竖变成减号,减号移过来一竖变成加号。具体看图片的几个例子。Input多个样例(大约2000个),每个样例占一行,有a+b=c 或a-b=c其中0 Output对于每个样例输出一个整数占一行
2015-05-31 18:29:40 868
原创 CSU1654: 收集金币
Description有一条路上有一排的金币,如果把这条路看做一个数轴,那么在1~n的位置上各有一个金币,共n个,每个金币有一个不同的编号1~n(不一定按顺序).在0位置上有一个人,他有很多神奇的小车,他可以在0位置释放神奇的小车,每个小车一旦被释放就会沿着数轴正方向每个单位时间走一个单位距离.如果一个小车所在的位置有金币且这个金币的编号是剩余金币中编号最小的,而且如果收集了这个金币能
2015-05-31 18:25:34 1308 1
原创 URAL1297:Palindrome(后缀数组)
DescriptionThe “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the competing «Robots Unlimited» has infiltrated into “U.S. Robotics”. «U.S. R
2015-05-31 00:40:10 2181 3
原创 SPOJ694&&SPOJ705:Distinct Substrings(后缀数组)
DescriptionGiven a string, we need to find the total number of its distinct substrings.InputT- number of test cases. TEach test case consists of one string, whose length is OutputFor e
2015-05-29 15:27:17 2310
原创 POJ3261:Milk Patterns(后缀数组)
DescriptionFarmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation, he discovered that although he can't predict the quality of milk fro
2015-05-29 15:10:55 4270
原创 poj1743:Musical Theme(后缀数组)
DescriptionA musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the piano. It is unfortunate but true that this re
2015-05-29 13:31:05 4577 3
原创 POJ2774:Long Long Message(后缀数组)
DescriptionThe little cat is majoring in physics in the capital of Byterland. A piece of sad news comes to him these days: his mother is getting ill. Being worried about spending so much on railwa
2015-05-28 20:23:36 4578
原创 CSU1631: Facility Locations
DescriptionThe HDWBP Inc. has n clients and needs to service these clients by opening k facilities. Each opened facility can serve any number of clients and each client must be served by an open f
2015-05-25 15:39:43 1001
原创 CSU1633: Landline Telephone Network
DescriptionThe mayor of RMRCity wants to create a secure landline telephone network for emergency use in case of serious disasters when the city is cut off from the outside world. Some pairs of bu
2015-05-25 14:41:07 1050
原创 CSU1635: Restaurant Ratings
DescriptionA famous travel web site has designed a newrestaurant rating system. Each restaurant is ratedby one of n (1 n 15) critics, each givingthe restaurant a nonnegative numeric rati
2015-05-25 14:09:27 1466
原创 CSU1630: Plane Ticket Pricing
DescriptionPlane ticket prices fluctuate wildly from one week to the next, and their unpredictability is a major source of frustration for travellers. Some travellers regret buying tickets too ear
2015-05-25 14:02:45 1053
原创 CSU1622: Generalized Roman Numerals(区间DP)
DescriptionInputOutputSample InputIVXXIXIX0Sample OutputCase 1: 4 6Case 2: 8 10 28 30 32HINTSource题意:给出一个罗马数字,要你输出这罗马数字所有可能组成的数罗马数字组成规则:1
2015-05-18 19:13:24 1393
原创 CSU1619: Con + tin / (ued + Frac / tions)
DescriptionInputOutputSample Input4 35 1 1 25 2 20 0Sample OutputCase 1:110 530 4 61 27HINTSource题意:根据给定的数字算出r1,r2,然后对于r1,r2的四则运算我们要用一系列的
2015-05-18 16:39:05 1720 1
原创 CSU1626: Time Warp
DescriptionInputOutputSample Input420 after 8126 til 4180 til 10 after 12Sample OutputCase 1: 8:47:16Case 2: 3:39:16Case 3: 12:32:44Case 4: 1:05:27HINT
2015-05-17 19:50:19 1021
原创 CSU1620: A Cure for the Common Code(KMP+区间DP)
DescriptionInputOutputSample Inputabcbcbcbcaabbbcdcdcdabbbcdcdcd0Sample OutputCase 1: 7Case 2: 11HINTSource题意:把字符串简化,问简化得到的最短长度是多少思路:要简化首先要
2015-05-17 19:48:54 1231
原创 Codeforces544E:Remembering Strings(状态压缩)
You have multiset of n strings of the same length, consisting of lowercase English letters. We will say that those strings are easy to remember if for each string there is some position i and some l
2015-05-15 22:30:42 1650
原创 Codeforces544D:Destroying Roads(最短路)
In some country there are exactly n cities and m bidirectional roads connecting the cities. Cities are numbered with integers from 1 to n. If cities a and b are connected by a road, then in an h
2015-05-15 13:51:14 2139
原创 Codeforces544C:Writing Code(完全背包)
Programmers working on a large project have just received a task to write exactly m lines of code. There are n programmers working on a project, the i-th of them makes exactly ai bugs in every lin
2015-05-15 13:48:22 1920
原创 Codeforces544B:Sea and Islands
A map of some object is a rectangular field consisting of n rows and n columns. Each cell is initially occupied by the sea but you can cover some some cells of the map with sand so that exactly k is
2015-05-15 13:41:11 1199
原创 Codeforces544A:Set of Strings
You are given a string q. A sequence of k strings s1, s2, ..., sk is called beautiful, if the concatenation of these strings is string q (formally,s1 + s2 + ... + sk = q) and the first characters
2015-05-15 13:37:38 1473
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人