HDU 5908 Abelian Period (BestCoder Round #88 模拟+暴力) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5908 Description Let S be a number string, and occ(S,x) means the times that number x occurs in S. i.e. S=(1,2,2,1,3),occ(S,1)=2,occ(S,2)=2,occ(S,3)=1.…
Abelian Period 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5908 Description Let S be a number string, and occ(S,x) means the times that number x occurs in S. i.e. S=(1,2,2,1,3),occ(S,1)=2,occ(S,2)=2,occ(S,3)=1. String u,w are matched if for each…
传送门 Description Let S be a number string, and occ(S,x) means the times that number x occurs in S. i.e. S=(1,2,2,1,3),occ(S,1)=2,occ(S,2)=2,occ(S,3)=1. String u,w are matched if for each number i, occ(u,i)=occ(w,i) always holds. i.e. (1,2,2,1,3)≍(1,3,…
http://acm.hdu.edu.cn/showproblem.php?pid=5908 要求把数组分成k组使得每组中的元素出现次数相同 就是分成k个集合,那么直接用multiset判定就可以 有重载相等运算符的 我被坑了的就是, 对于2个元素一个集合的可以,那么,4,6,8这样分集合也是可以的. 这个很容易理解 但是,你也要能平均分才行啊 就是10的2可以,但是4是一定不可以得.不能平均分 #include <cstdio> #include <cstdlib> #inclu…
传送门:BestCoder Round #88 分析: A题统计字符串中连续字串全为q的个数,预处理以下或加个cnt就好了: 代码: #include <cstdio> #include <cstring> #include <cstdlib> #include <ctime> #include <cmath> #include <iostream> #include <algorithm> #include <st…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4956 Poor Hanamichi Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7    Accepted Submission(s): 4 Problem Description Hanamichi is taking part in…
就是阶梯NIM博弈,那么看层数是不是奇数的异或就行了: #include<iostream> #include<cstdio> #include<algorithm> #include<cstdlib> #include<cstring> #include<string> #include<cmath> #include<map> #include<set> #include<vector&g…
HDU 5904 - LCIS [ DP ]    BestCoder Round #87 题意: 给定两个序列,求它们的最长公共递增子序列的长度, 并且这个子序列的值是连续的 分析: 状态转移方程式: dp[a[i]] = max(dp[a[i]], dp[a[i]-1] + 1); 发现其实可以简化为 dp[a[i]] = dp[a[i]-1] + 1:因为计算过程中dp[a[i]]不会降低 对两个序列都求一遍,然后取两者最小值的最大值 #include <cstdio> #include…
Task schedule Problem Description 有一台机器,而且给你这台机器的工作表.工作表上有n个任务,机器在ti时间运行第i个任务,1秒就可以完毕1个任务. 有m个询问,每一个询问有一个数字q.表示假设在q时间有一个工作表之外的任务请求,请计算何时这个任务才干被运行. 机器总是依照工作表运行,当机器空暇时马上运行工作表之外的任务请求.   Input 输入的第一行包括一个整数T, 表示一共同拥有T组測试数据. 对于每组測试数据: 第一行是两个数字n, m,表示工作表里面有…
Sequence  Accepts: 59  Submissions: 650  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Others) Problem Description \ \ \ \    Holion August will eat every thing he has found. \ \ \ \    Now there are many foods,but he does…