Ural 1011. Conductors】的更多相关文章

1011. Conductors Time limit: 2.0 secondMemory limit: 64 MB Background Everyone making translations from English to Russian knows an English phrase "Naked conductor runs along the bus". It has two very different meanings. Problem Every bus in the…
URAL题解一 URAL 1002 题目描述:一种记住手机号的方法就是将字母与数字对应,如图.这样就可以只记住一些单词,而不用记住数字.给出一个数字串和n个单词,用最少的单词数来代替数字串,输出对应的任一方案. solution 首先想到的应该是DP,接着就是状态转移的问题,也就是预处理出每个单词可以与哪一段的数字对应,分析时间复杂度,发现直接暴力判断是可以的,但用HASH会好一些,还可以用KMP. 时间复杂度:\(O(单词数*数字长度)或O(单词长度*数字长度)\) URAL 1010 题目描…
URAL 1005 给定一些石头的重量,要求分成两个部分最相近.二进制暴力枚举. #include <bits/stdc++.h> using namespace std; ]; int main() { // freopen("in.txt","r",stdin); int n; scanf("%d",&n); ; ; i < n; i++) { scanf("%d",&w[i]); sum…
        题目1001:       大意:已知$n$个角色,$m$种怪物种族,$k$个怪物,给出一组角色编号,编号$P_{i}$的角色能肝死编号$i$的怪物,对于给定的一组怪物编号,为了打通关,求切换角色的次数.另外初始默认第$1$个角色上场.       思路:模拟水题,没啥好说的,先随便弄个数组比如叫$monitors$,于是$monitors[i]$$=$$P_{i}$,然后去肝那群怪,初始变量$actor$$=$$1$,循环每次读一个怪物编号$x$,如果$monitors[x]$…
http://poj.org/problem?id=1011 这是一道POJ的搜索的题目,最开始确实难以理解,但做过一些搜索的题目后,也没那么难了. 大概题意就是,现在有N根木头,要拼成若干根木头,并且这些木头要相等的长度,并且每一根木头都要用上,求组成的木头最短长度是多少 思路: 首先木头肯定要由大到小进行排序,组成的最短的木头的长度的范围应该在最长的木头到所有的木头之和之间. 其次就是木头使用过后不能在使用,所以木头应该进行标记. #include <stdio.h> #include &…
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串中心位置,RMQ询问LCP = min (height[rank[l]+1] to height[rank[r]]),注意的是RMQ传入参数最好是后缀的位置,因为它们在树上的顺序未知,且左边还要+1. #include <cstdio> #include <algorithm> #in…
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and each orders a juice cocktail. It could be from 1 to 3 different juices in each cocktail. There are three juices in the bar: apple, banana and pineappl…
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best programmer in the world! Now he regularly takes part in various programming contests, attentively listens to problems analysis and upsolves problems. But…
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate integers together in their spare time. Nikolay thinks an integer is interesting if it is a prime number. However, Asya thinks an integer is interesting i…
2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock band on Earth. Band decided to make the most awesome music video ever for their new single. In that music video Ilya will go through Manhattan standi…