HDU 2700 Parity(字符串,奇偶性)】的更多相关文章

Parity Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1855    Accepted Submission(s): 1447 Problem Description A bit string has odd parity if the number of 1's is odd. A bit string has even pa…
Problem Description A bit string has odd parity if the number of 1's is odd. A bit string has even parity if the number of 1's is even.Zero is considered to be an even number, so a bit string with no 1's has even parity. Note that the number of 0's d…
题目链接:HDU 1274 展开字符串 中文题. 左括号进入DFS函数,右括号return到上一层. 注意return回去的是这个一层递归中的括号中的字母串. AC代码: #include<stdio.h> #include<iostream> #include<string.h> #include<string> using namespace std; char str[300]; bool vis[300]; int len; string dfs(i…
Bazinga Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2287    Accepted Submission(s): 713 Problem Description Ladies and gentlemen, please sit up straight.Don't tilt your head. I'm serious.For…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4622 题意:给定一个长度不超过2000的字符串,之后有不超过1e5次的区间查询,输出每次查询区间中不同的子串个数? 做法1:字符串hash 一般的做法就是模拟每段子串的长度L(从1到 len),这样时间复杂度为O(n^2);但是里面并没有计算子串比较是否相等以及存储的时间,而这段时间就是将字符串看成是“数字”,这样存储和比较的时间均降为O(1)了: 下面讲讲模板: 1.如何将字符串看成一个“高精度的…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2585 题目大意:马克思要找个曾经去过的很好的旅馆,可惜他记不完整旅馆的名字.他有已知的部分信息和可能的旅馆全称,输出匹配的旅馆名个数.已知信息中‘*’代表此处为0或多个小写字母,‘?’代表此处仅有一个小字母. 代码如下 //匹配字符串递归 #include<iostream> #include<string> using namespace std; bool find(string…
http://acm.hdu.edu.cn/showproblem.php?pid=5059 确定输入的数是否在(a,b)内 简单字符串处理 #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include <queue> #include <set> #include <iostre…
Parity Time Limit: 2000/1000 MS(Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4334    Accepted Submission(s): 3264 Problem Description A bit string hasodd parity if the number of 1's is odd. A bit string has even pari…
A + B Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 571020    Accepted Submission(s): 181151 Problem Description Calculate A + B.   Input Each line will contain two integers A and B. P…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4821 题目大意:给你M,L两个字母,问你给定字串里不含M个长度为L的两两相同的子串有多少个? 哈希+枚举 我就是不会枚举这样的,这次涨姿势了. 每次枚举起点,然后就能枚举全部的. #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <alg…