【BestCoder Round #93 1001】MG loves gold】的更多相关文章

[题目链接]:http://acm.hdu.edu.cn/showproblem.php?pid=6019 [题意] 每次选择一段连续的段,使得这一段里面没有重复的元素; 问你最少选多少次; [题解] 从第一个元素开始一直选就好; 不能选了就把之前的记忆清除掉; 然后重新开始选;重新记忆选过哪些元素; 写个map就好. [完整代码] #include <bits/stdc++.h> using namespace std; #define lson l,m,rt<<1 #defin…
[题目链接]:http://acm.hdu.edu.cn/showproblem.php?pid=6020 [题意] 给你一个长度为n的数字,然后让你删掉k个数字,问你有没有删数方案使得剩下的N-K个数字是3的倍数; [题解] 这里我们枚举最后N-K个数字它的最高位是第几位; 这样我们就能在枚举最高位的时候直接判断这个数字是不是0;这样对合法性的处理就简单很多了; 我们枚举第i位是最高位,言外之意就是说前i-1个数字已经全部被删掉了; 则我们要在i+1..n这些数字里面再删掉k-i+1个数字才行…
[题目链接]:http://acm.hdu.edu.cn/showproblem.php?pid=6022 [题意] 让你求一个集合的子集数目; 这个子集有要求; 即: 它所有元素的平方的和小于它所有元素的和的平方. [题解] 假设一个集合大小为3元素为a1,a2,a3 则 a12+a22+a32<=(a1+a2+a3)2 化简一下可以得到 a1∗a2+a1∗a3+a2∗a3>=0 所以原限制条件其实可以转化为一个集合里面任意两个数的乘积的和大于等于0; 但是你不好直接去枚举这个集合的子集:…
题目传送门 /* m数组记录出现的花色和数值,按照数值每5个搜索,看看有几个已满足,剩下 5 - cnt需要替换 ╰· */ #include <cstdio> #include <algorithm> #include <iostream> #include <cstring> #include <string> using namespace std; ; const int INF = 0x3f3f3f3f; int main(void)…
题目传送门 /* 字符串处理:是一道水题,但是WA了3次,要注意是没有加'\0'的字符串不要用%s输出,否则在多组测试时输出多余的字符 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using namespace std; typedef long long ll; ; const int INF = 0x3f3f3f3f; char ss[MAXN…
题目传送门 /* 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少: 否则再在tot里减去多余的即为答案 用set容器也可以做,思路一样 */ #include <cstdio> #include <iostream> #include <cstring> #include <string> #include <algorithm> using namespace std; ; const i…
题目传送门 /* 暴力:模拟枚举每一个时间的度数 详细解释:http://blog.csdn.net/enjoying_science/article/details/46759085 期末考结束第一题,看看题解找找感觉:) */ #include <cstdio> #include <algorithm> #include <cstring> #include <vector> #include <iostream> using namespa…
MG loves gold Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 1607    Accepted Submission(s): 659     Problem Description MG is a lucky boy. He is always be able to find gold from underground…
MG loves gold  Accepts: 451  Submissions: 1382  Time Limit: 3000/1500 MS (Java/Others)  Memory Limit: 262144/262144 K (Java/Others) Problem Description MG is a lucky boy. He is always be able to find gold from underground. It is known that the gold i…
MG loves string  Accepts: 30  Submissions: 67  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 262144/262144 K (Java/Others) 问题描述 MG是一个很忙碌的男孩子.今天他沉迷于这样一个问题: 对于一个长度为N的由小写英文字母构成的随机字符串,当它进行一次变换,所有字符i都会变成a[i]. MG规定所有a[i]构成了26个字母组成的排列. MG现在需要知道这个随机串…