题意1: 给你一个由小写字母构成的字符串s,你可以其中某些字符变成大写字母.如果s中有字母a,你如果想把a变成大写,那s字符串中的每一个a都要变成A 最后你需要要出来所有的字符对,s[i]和s[i-1]需要是辅音字母,且s[i]和s[i-1]中需要一个字母大写另一个小写.a.e.i.o.u.w.y这七个字母是元音 输出最大字符对数量 题解1: 首先预处理一下s字符串中字符相邻的数量,就是记录w[s[i-1]][s[i]]的数量 之后二进制枚举所有字母变成大写的情况. 然后枚举这个字母变成大写之后…
题意:给你一个只含\(+\)和\(-\)的字符串,统计它的加减和,然后再给你一个包含\(+,-,?\)的字符串,其中\(?\)可以表示为\(+\)或\(-\),问有多少种情况使得第二个字符串的加减和等于第一个. 题解:首先我们统计第一个字符串的和,然后统计第二个字符串的加减和以及\(?\)的个数,然后对于\(?\)我们进行二进制枚举,枚举它的所有可能情况的和,再加上第二个字符串的和每次判断一下是否和第一个相等即可. 代码: char s[N],t[N]; int main() { //ios::…
[二进制枚举+LCS]Card Hand Sorting 题目描述 When dealt cards in the card game Plump it is a good idea to start by sorting the cards in hand by suit and rank. The different suits should be grouped and the ranks should be sorted within each suit. But the order o…
时间限制: 3 Sec 内存限制: 512 MB 题目描述 There are two kinds of sounds in spoken languages: vowels and consonants. Vowel is a sound, produced with an open vocal tract; and consonant is pronounced in such a way that the breath is at least partly obstructed. For…
https://vjudge.net/problem/Gym-100712G 题意:给出n枚不同价值的硬币和一个总价S,现在要选择尽量多的硬币来大于等于S,要求是比如说现在选择的硬币的总和为sum,那么所选择的任何一个硬币x,sum-x都必须<S. 思路: 一开始是想排序然后优先选择小的...没想到最后是暴力枚举. 因为N很小,最大也就是10,每枚要么选,要么不选,二进制枚举. #include<iostream> #include<algorithm> #include&l…
Lara Croft, the fiercely independent daughter of a missing adventurer, must push herself beyond her limits when she discovers the island where her father disappeared. In this mysterious island, Lara finds a tomb with a very heavy door. To open the do…
这个题其实由于只有4种花色的,那么每种花色排列的顺序,也不过是4!种,然后对于每种花色内部到底是升序还是降序,其实也可以直接暴力,一共也就4!*2^4种情况,然后直接进行排序就可以了,但是我们如何计算需要移动的位置呢???我们这样考虑,我们由于要保证内部有序,那么最后一定是一个升序或者降序,那么插入一张牌,实际上是相当改变内部相对位置,那么考虑无序的,我们肯定是找到最长的递增子序列,那么他们一定是不用互相移动的,而其他的肯定是要移动的,因为他们不满足前后的顺序,并且他们是肯定是要移动的,直接二进…
Problem UVA12113-Overlapping Squares Accept:116  Submit:596 Time Limit: 3000 mSec  Problem Description  Input The input consists of several test cases. Each test case is contained in five lines and each line contains nine characters. If the horizontal…
任意门:http://hihocoder.com/problemset/problem/1829 Tomb Raider 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 Lara Croft, the fiercely independent daughter of a missing adventurer, must push herself beyond her limits when she discovers the island where her fath…
题目大意:给你N个字符串,你可以从中选择任意数量的字符串,请统计在你的字串中,相同字母出现次数正好为K次的字母数.数据保证出现的字母都是小写字母. 1≤N≤15 1 ≤K≤N 一开始读题的时候读错了,读成了至少为k次,就想的暴力选择全部字符串,然后统计字母数,但是在认真读题WA了N发后发现是恰好为K次,所以正确打开方式应该是 用二进制枚举所有选择方案,然后不断更新最大值. 因为每一个字符串在本题中只有两种状态:选(1),不选(0) 所以我们对于所有字符串总共有2^N个方案 我们随意取其中一个例子…