
ACM_字符串
文章平均质量分 73
_天道酬勤_不忘初心
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDU 1048 The Hardest Problem Ever
题目地址:点击打开链接思路:不用找规律,直接贴数组,数组开大点,否则会错AC代码:#include #includeusing namespace std;int main(){ int n,i; char a[27] = "VWXYZABCDEFGHIJKLMNOPQRSTU"; char cipher[1000]; while(cin.g原创 2015-07-25 12:09:56 · 355 阅读 · 0 评论 -
HDU 1106 排序(切割字符串)
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1106思路:给点测试数据555445555 输出44544 输出4415551 输出1 1AC代码1:#include #include #include #include #include #include #原创 2016-04-09 19:23:02 · 351 阅读 · 0 评论 -
河南第四届ACM省赛(表达式求值)
题目地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=305思路:有点SQL语句的味道,测试好多数据都对,交上去就是RE,有时间改错误代码:#include #include #include #include #include #include #include #include #include #includ原创 2016-02-11 18:23:24 · 450 阅读 · 0 评论 -
HDU 1708 Fibonacci String(字符串模拟)
题目地址:点击打开链接思路:任意一个字符串都是由最初的第零个和第一个构成的,只要记录含有的第零个和第一个字符串的个数即可AC代码:#include #include #include #include #include #include #include #include #include #include #include typedef long long原创 2015-11-21 14:07:00 · 957 阅读 · 0 评论 -
HDU 1075 What Are You Talking About(用map进行翻译)
题目地址:点击打开链接题意:给出日语和英语的对应词典,输入一段日语,把日语翻译成英语,不是小写字母字符的不进行翻译,例如逗号,空格,没有对应英语的日语则直接输出日语思路:字典树,二分查找,map映射,都可以做,效率逐渐降低,代码逐渐缩短,本题用map映射没超时AC代码:#include #include #include #include #include #includ原创 2015-09-25 20:18:28 · 697 阅读 · 0 评论 -
HDU 5455 Fang Fang(字符串模拟)
题目地址:点击打开链接题意:给你一个字符串首尾相接问最少能由几个F子串给出构成,F子串的定义如题思路:需要注意的就几点(1)2个c之间的f数不能少于2(2)s字符串中不能有别的字符(3)假如第一个字符为f则,最后一个c字符后面的f加上最前面的f字符的数量不能少于2,假设第一个字符不为f,则最后一个c字符后面的f字符数量不能少于2(4)全是f字符的情况,网赛的时候少考虑只有一个f的特殊情况,原创 2015-09-20 14:12:41 · 417 阅读 · 0 评论 -
HDU 1274 展开字符串(深搜+字符串,显示缩写的字符串)
题目地址:点击打开链接思路:深搜+字符串,直接看代码AC代码:#include #include #include #include //islower的头文件using namespace std;char a[300];void dfs(int left,int right){ int i,j,count1,count2,l,r; for(i=l原创 2015-09-06 17:22:05 · 658 阅读 · 0 评论 -
ZOJ 1109 Language of FatMouse
题目地址:点击打开链接思路:用STL容易超时,本题没有超时,用字典树比较麻烦,可以先排序再二分搜索AC代码:#include #include #include #include using namespace std;int main(){ map entry; char a[20],b[20],c[40]; string value,key;原创 2015-08-19 21:43:08 · 651 阅读 · 0 评论 -
HDU 1671 Phone List
题目地址:点击打开链接思路:可以用字典树做,但是比较麻烦,可以吧string类型放进vector,然后排序,看每个string与前一个是否有相同的部分AC代码:#include#include#include#includeusing namespace std;int main(){ int n,m,i; vector v; string s; //freopen原创 2015-07-25 14:37:49 · 362 阅读 · 0 评论 -
HDU 1287 破译密码
题目地址:点击打开链接思路:异或运算法则1. a ^ b = b ^ a 2. a ^ b ^ c = a ^ (b ^ c) = (a ^ b) ^ c; 3. d = a ^ b ^ c 可以推出 a = d ^ b ^ c. 4. a ^ b ^ a = b.异或还有逆运算 a^b=c,则a=b^cAC代码:#includeint a[3原创 2015-08-13 09:22:29 · 391 阅读 · 0 评论 -
HDU 4730 We Love MOE Girls
题目地址:点击打开链接思路:挺有新意AC代码:#include#includechar a[120];int main(){ int t,i,m; scanf("%d",&t); for(i=1; i<=t; i++) { scanf("%s",a); m = strlen(a); if(a[m-1] == 'u' && a[m-2] == 's' &&原创 2015-08-12 16:26:27 · 320 阅读 · 0 评论 -
HDU 1238 Substrings
题目地址:点击打开链接思路:string的子串:string substr(int pos = 0,int n = npos) const;//返回pos开始的n个字符组成的字符串int find(const string &s, int pos = 0) const;//从pos开始查找字符串s在当前串中的位置查找成功时返回所在位置,失败返回string::npos的值AC代原创 2015-08-12 18:10:25 · 351 阅读 · 0 评论 -
HDU 1200 To and Fro
题目地址:点击打开链接思路:水题AC代码:#include #include char a[110][21],str[210];using namespace std;int main(){ int n,i,j,k; while(cin>>n && n) { k = 0; cin>>str; for原创 2015-08-11 16:18:35 · 388 阅读 · 0 评论 -
HDU 1321 Reverse Text
题目地址:点击打开链接思路:STLAC代码:#include#include#includeusing namespace std;int main(){ char a[70]; int t; string s; scanf("%d",&t); getchar(); while(t--) { cin.getline(a,80); s = a;原创 2015-08-11 10:21:42 · 370 阅读 · 0 评论 -
POJ 1555 Polynomial Showdown(字符串模拟)
题目地址:http://poj.org/problem?id=1555思路:注意都是0的情况输出是0,不能通过加和判断是否所有的数都为0,虽然会AC,这是数据问题,狂测的时候测出来的BUG,给个例子啊0 0 1 -1 0 0 0 0 0 虽然和为0,但是数据输出不应该是0AC代码:#include #include #include #include #include #原创 2016-05-02 15:24:24 · 436 阅读 · 0 评论