HDOJ 4749 Parade Show】的更多相关文章

说实在的在比赛时看错了题意,一直对最后一段的描述不是很清楚.闲话少说: 题意:给一个主串,再一个副串,问主串中有多少个子串和副串的的规律相同,即相邻的相等大于小于,用过的就不能再用了. #include <stdio.h> #include <string.h> #include <stdlib.h> ],B[]; int find(int i,int m) { int j; ;j <= m - ;j ++) { ] && B[j] == B[j…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4749 Problem Description   2013 is the 60 anniversary of Nanjing University of Science and Technology, and today happens to be the anniversary date. On this happy festival, school authority hopes that th…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4749 题目大意:给一个原序列N,再给出一个序列M,问从N中一共可以找出多少个长度为m的序列,序列中的数的相对大小关系与序列M中相对大小关系相同.(序列之间不能重叠) 解题思路:从头开始以i为起点暴搜,不断找长度为m的序列,判断是否满足条件.若满足,跳到i+m之后继续搜,若不满足,向后移一位继续搜. 判断方法压缩数据比较相对大小. #include<cstdio> #include<cstri…
题目链接 题目都看不懂,做毛线...看懂了之后就是kmp出,所有的匹配区间,然后DP可以写,贪心也可以做把,DP应该需要优化一下,直接贪,也应该对的,经典贪心问题. #include<iostream> #include<cstring> #include<cstdio> #include<cmath> #include<algorithm> using namespace std; ],s2[]; ],o[]; ]; ]; int judge(…
看大神代码,发现上交大神很棒的一个思路 题意: 在源数字串中找出尽量多的连续子串,要求子串任意两值的大小关系与目标串相同位置的值的大小关系相同.求源串能拿出的子串的最大数量. 关键词: RK-Hash 优点: O(k)时间完成匹配检查(关键在于他能O(1) 完成 所有 相同位 检查) 方法: 对于一个K值,用某个进制数来表示其位置. 比如 123121 中 的值 1 最后表示成 100101. 然后,对于目标串也RK-hash,对于某个值,只要比较这个数,就能知道是否相同位都相同了. 代码留恋:…
 HK.... Rain on your Parade Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 655350/165535 K (Java/Others)Total Submission(s): 2229    Accepted Submission(s): 696 Problem Description You're giving a party in the garden of your villa by the sea…
读题显然是二分图匹配,看成guest与umbrella的匹配.匈牙利果断TLE了,其实时间卡的相当紧.HK过的,750ms. /* 2389 */ #include <iostream> #include <string> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #include <algori…
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 56784    Accepted Submission(s): 19009 Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats g…
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3049    Accepted Submission(s): 2364 Problem Description You are the CEO of Nasty Hacks Inc., a company that creates small pieces of…
Box of Bricks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5994    Accepted Submission(s): 2599 Problem Description Little Bob likes playing with his box of bricks. He puts the bricks one up…