Problem Description We define the distance of two strings A and B with same length n isdisA,B=∑(i=0  n−1)  |A[i]−B[n−1−i]|The difference between the two characters is defined as the difference in ASCII.You should find the maximum length of two non-ov…
Kirinriki Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2169    Accepted Submission(s): 879 Problem Description We define the distance of two strings A and B with same length n isdisA,B=∑i=0n−…
题目链接:Kirinriki 题目描述: 找两个不重叠的字符串A,B. 使得dis(A,B)<=m;\(dis(A,B)= \sum _{i=0}^{n-1} \left | A_i-B_{n-1-i} \right |\).求最长的字符串长度. 思路: 官方题解,双指针维护.简单题.枚举对称中心. 在这里我给出我常用的双指针的写法. int a[N]; int l=0,r=0,val=0; while(r没有越界) //如果满足条件 { if(val+a[r]<=key) // 加上 a[r…
http://acm.hdu.edu.cn/showproblem.php?pid=6103 题意: 给出一个字符串,在其中找两串互不重叠的子串,计算它们之间的dis值,要求dis值小于等于m,求能选的子串的最大长度. 思路: 由于这两个子串是互不重叠的,那么这两个子串之间的间隔可以是奇数也可以是偶数,针对这两种情况我们枚举中心点,然后尺取法处理,具体看代码就懂了. #include<iostream> #include<algorithm> #include<cstring…
题目链接 Problem Description We define the distance of two strings A and B with same length n is disA,B=∑i=0n−1|Ai−Bn−1−i| The difference between the two characters is defined as the difference in ASCII. You should find the maximum length of two non-over…
We define the distance of two strings A and B with same length n is dis A,B =∑ i=0 n−1 |A i −B n−1−i | disA,B=∑i=0n−1|Ai−Bn−1−i| The difference between the two characters is defined as the difference in ASCII. You should find the maximum length of tw…
Problem Description We define the distance of two strings A and B with same length n isdisA,B=∑i=0n−1|Ai−Bn−1−i|The difference between the two characters is defined as the difference in ASCII.You should find the maximum length of two non-overlapping…
Hdu 5806 NanoApe Loves Sequence Ⅱ(双指针) Hdu 5806 题意:给出一个数组,求区间第k大的数大于等于m的区间个数 #include<queue> #include<cmath> #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<algorithm> #define ll l…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5358 题意:如题. 解法:观察式子发现,由于log函数的存在,使得这个函数的值域<=34,然后我们枚举这个值域,对于这个值域,我们用双指针O(n)维护值前缀和在这个值域里面的区间,计算即可. #include <bits/stdc++.h> using namespace std; const int maxn = 100005; typedef long long LL; LL l[35]…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2489 思路:由于N, M的范围比较少,直接枚举所有的可能情况,然后求MST判断即可. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <vector> using namespac…