【枚举】URAL - 2081 - Faulty dial】的更多相关文章

题目: Faulty dial Pavel has not played ACM for ages, nor does he train teams, nor prepare problems. The thing is that there are much more global issues that concern him — Pavel ponders on education as a whole. His thoughts are always busy with this, bu…
//._. ... ._. ._. ... ._. ._. ._. ._. ._. //|.| ..| ._| ._| |_| |_. |_. ..| |_| |_| //|_| ..| |_. ._| ..| ._| |_| ..| |_| ._| #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef pair<int,int> Point;…
URAL 2078~2089 A - Bowling game 题目描述:给出保龄球每一局击倒的球数,按照保龄球的规则,算出总得分的最小值和最大值. solution 首先是最小值:每一局第一球击倒\(0\)个,第二球击倒给定的数目,最后一局比较特殊,如果最后一局得分超过\(20\),最后一局只能是\(10, 10, ?\),否则第一球可以击倒\(0\)个. 然后是最大值:每一局击倒给定的数目,最后一局的击球数往前靠. 然后按规则算分即可. 时间复杂度:\(O(10)\) C - Wallet…
1792. Hamming Code Time limit: 1.0 second Memory limit: 64 MB Let us consider four disks intersecting as in the figure. Each of the three shapes formed by the intersectionof three disks will be called a petal. Write zero or one on each of the disks.…
2031. Overturned Numbers Time limit: 1.0 second Memory limit: 64 MB Little Pierre was surfing the Internet and came across an interesting puzzle: What is the number under the car? It took some time before Pierre solved the puzzle, but eventually he u…
设horns和hoofs的数量分别为 x 和 y ,题目要求: 满足 x+y <= K,使得A*x + B*y - x*x - y*y 最大. 枚举 i 从0~K,直接解方程得对称轴 x = ( 2*i + A - B ) / 4,判断对称轴是否在 [ 0, i ] 区间内. 注意: 1.精度 2.x需要上下个取整一次 3.如果最大值都<=0,那么最大收益直接为 0 即可. #include <cstdio> #include <cstring> #include &l…
题意:有n杯盐溶液,给定每杯里面盐的质量以及盐溶液的质量.问你有多少种方案选择一个子集,使得集合里面的盐溶液倒到一个被子里面以后,浓度为A/B. 折半枚举,暴力搜索分界线一侧的答案数,跨越分界线的答案,一侧用map存下来,枚举另一侧去统计. #include<cstdio> #include<map> using namespace std; typedef long long ll; ll ans; int n,a,b,m[39],t[39]; map<ll,int>…
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即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…
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…